A number of ecologically and economically important pathogens exhibit a complex transmission dynamics that involves distinct transmission modes. In this paper, we study the evolutionary dynamics of pathogens for which transmission includes direct host-to-host as well as indirect environmental transmission. Different routes of infection spread require specific adaptations of the parasite, which may result in conflicting selection pressures. Using the framework of Adaptive dynamics, we investigate how these conflicting selection pressures are resolved in the course of evolution and determine the conditions for evolutionary diversification of pathogen strains. We show that evolutionary branching and subsequent evolution of specialist strains occurs in wide parameter regions but evolutionary bistability and evolution of generalist pathogens are possible as well. Our analysis reveals that the relative contributions of direct and environmental transmission, as well as the underlying ecological dynamics, play a crucial role in shaping the course of pathogen evolution. Our findings may explain the coexistence of high and low virulence strains observed in several pathogenic organisms using different transmission modes (e.g., influenza viruses) and highlight the importance of considering ecological dynamics in virulence management.