Use baby gates
Train "stay" at all applicable doors - use a long leash and tie him to a point where he can reach up to the door entrance. Train him to stay while leaving the door open and walking around him. Then, tell him to stay while you're outside the door. Do this daily with train & treats and he'll learn that staying on the inside of the door is a great thing! Note that you need to do this separately with ALL doors. At a new place, the doors are all different!
It's also not a bad idea to always walk through all doorways before your dog. If he always likes to bypass you - it's rude!
Train him to follow you for his safety