Habitat avoidance is an anti-parasite behaviour exhibited by at-risk hosts that can minimize exposure to parasites. Because environments are often heterogeneous, host decision-making with regards to habitat use may be affected by the presence of parasites and habitat quality simultaneously. In this study we examine how the ovipositing behaviour of a cactiphilic fruit fly, Drosophila nigrospiracula, is affected by the presence of an ectoparasitic mite, Macrocheles subbadius, in conjunction with other environmental factors – specifically the presence or absence of conspecific eggs and host plant tissue. We hypothesized that the trade-off between site quality and parasite avoidance should favour ovipositing at mite-free sites even if it is of inferior quality. We found that although flies avoided mites in homogeneous environments (86% of eggs at mite-free sites), site quality overwhelmed mite avoidance. Both conspecific eggs (65% of eggs at infested sites with other Drosophila eggs) and host plant tissue (78% of eggs at infested sites with cactus) overpowered mite avoidance. Our results elucidate the context-dependent decision-making of hosts in response to the presence of parasites in variable environments, and suggest how the ecology of fear and associated trade-offs may influence the relative investment in anti-parasite behaviour in susceptible hosts.