From the microscopic to the macroscopic level, biological life exhibits directed migration in response to environmental conditions. Chemotaxis enables microbes to sense and move towards nutrient-rich regions or to avoid toxic ones. Socio-economic factors drive human populations from rural to urban areas. The effect of collective movement is especially significant when triggered in response to the generation of public goods. Microbial communities can, for instance, alter their environment through the secretion of extracellular substances. Some substances provide antibiotic-resistance, others provide access to nutrients or promote motility. However, in all cases the maintenance of public goods requires costly cooperation and is consequently susceptible to exploitation. The threat of exploitation becomes even more acute with motile individuals because defectors can avoid the consequences of their cheating. Here, we propose a model to investigate the effects of targeted migration and analyze the interplay between social conflicts and migration in ecological public goods. In particular, individuals can locate attractive regions by moving towards higher cooperator densities or avoid unattractive regions by moving away from defectors. Both migration patterns not only shape an individuals immediate environment but also affects the entire population. For example, defectors hunting cooperators have a homogenizing effect on population densities. This limits the production of the public good and hence inhibits the growth of the population. In contrast, aggregating cooperators promote the spontaneous formation of patterns through heterogeneous density distributions. The positive feedback between cooperator aggregation and public goods production, however, poses analytical and numerical challenges due to its tendency to develop discontinuous distributions. Thus, different modes of directed migration bear the potential to enhance or inhibit the emergence of complex and sometimes dynamic spatial arrangements. Interestingly, whenever patterns emerge, cooperation is promoted, on average, population densities rise, and the risk of extinction is reduced.