it can depend on many things alffe.
not drinking enough water. holding it for too long...sex can introduce bad bacteria.
wiping the wrong way.
just for starters.
some just are prone to them. but keeping a higher acidity level helps. like drinking cranberry juice.