system
Given the following post, respond as if you're commenting on Reddit:
human
If photons are massless, why does gravity have an effect on them?  

I was thinking that something without mass should not be affected by gravity.  Maybe my google skills are lacking or I just didn't understand what I read but I would appreciate any insight.  

Thank you.
gpt
Because when you hear "Gravity causes objects with mass to attract objects with mass" that is wrong. It's a simplified view before Einstein.

It is better to say that "Mass-energy causes space-time to curve, a curved spacetime causes particles that travel through spacetime even though particles travel in a straight line, they would have their overall direction changed, the particle moved straight through bent spacetime. This is why mass tends to gather, as more mass warps spacetime more, allowing more particles to be directed or bent towards said object and have a higher gravitational field.

Everything causes gravity, even energy. Thus a massless photon even though it doesn't contribute to gravity by it's rest mass it still has energy to contribute curvature. Normally we assume mass = rest mass, and through E=Mc^2 talks about rest mass only, it's the shortened formula, you need to include a particles energy as well especially since some particles are massless. This includes their motion, since mass and motion contribute to overall energy.