2 year old hitting

My son turned 2 in July. And that's when he started throwing more, yelling and hitting. At first I noticed it was because he couldn't communicate well. I just told him I will not allow you to hit. That hurts. Now I notice it's when he's frustrated and doesn't get his way. I'm guessing it's normal. I don't yell or get angry but I'm not sure how to redirect him. I know it won't be perfect but it would be nice to hear some advice.