1. Urban areas are often considered to be a hostile environment for wildlife as they are highly fragmented and frequently disturbed. However, these same habitats can contain abundant resources, while lacking many common competitors and predators. The urban environment can have a direct impact on the species living there, but can also have indirect effects on their parasites and pathogens. To date, relatively few studies have measured how fine-scale spatial heterogeneity within urban landscapes can affect parasite transmission and persistence. 2. Here we surveyed 237 greenspaces across the urban environment of Edinburgh (UK) to investigate how fine-scale variation in socio-economic and ecological variables can affect red fox (Vulpes vulpes) marking behaviour, gastrointestinal (GI) parasite prevalence and parasite community diversity, 3. We found that the presence and abundance of red fox faecal markings was non-uniformly distributed across greenspaces, and instead was dependent on the ecological characteristics of a site. Specifically, common foraging areas were left largely unmarked, which indicates that suitable resting and denning sites may be limiting factor in urban environments. In addition, the amount of greenspace around each site was positively correlated with overall GI parasite prevalence, species richness and diversity, highlighting the importance of greenspace (a commonly used measure of landscape connectivity) in determining the composition of the parasite community in urban areas. 4. Our results suggest that fine scale variation within urban environments can be important for understanding the ecology of infectious diseases in urban wildlife and could have wider implication for the management of urban carnivores.