Restrict your puppy's access in the house by keeping him tethered to you or gated in the same room with you so you can keep a close eye on him at all times.
Crate or otherwise confine your puppy when you can't watch him closely. This will prevent him from having the opportunity to make mistakes.
Take your puppy outside frequently, as often as every 10-15 minutes to start, while he's active, so he has plenty of opportunities to eliminate in the correct location. You can gradually extend the time between potty breaks as your puppy grows and develops the ability to "hold it".
Always accompany your puppy for potty breaks so you have the opportunity to praise him the moment he finishes eliminating in the correct place.
Take your puppy to the same outdoor location each time.
Don't punish your puppy for making mistakes, especially after the fact. Just pay better attention next time so you can prevent mistakes from happening in the first place.
Be sure to thoroughly clean up any indoor accidents with an enzymatic cleaner. Odors left behind can trigger you puppy to eliminate there again.
Provide your puppy with an indoor potty area if you must keep him confined for longer than he is capable of holding it. You can remove the indoor potty area when your puppy gains the ability to hold it for the full length of his confinement.
Be patient and consistent.