Microorganisms regulate key processes in soils and aquifers, including nutrient cycling, carbon turnover and contaminant degradation. Many bacteria use chemotaxis, the ability to sense and swim toward chemical signals, to locate nutrient-rich hotspots. However, natural subsurface environments are highly heterogeneous, containing complex pore networks that create strong variations in fluid flow and nutrient availability. How these physical conditions influence bacterial foraging has remained poorly understood.