Stop your dog from defecating on the porch with a consistent training program. Dogs will use one area and repeat defecation in that area until they are redirected and trained to use a new area. You must form the new habit with a rewards program that encourages using a new area rather than punishing the existing behavior.
Know Your Dog
Learn your dog's habits and schedule. Many dogs defecate first thing in the morning and again in the evening. Housebroken indoor dogs are the easiest because they wait to go outside. This gives you control over the timing. The immediate hours after feeding the dog are also common times for defecating. Get on your dog's schedule to train him off the porch.
Put your dog on a leash and walk him past the porch when he is ready to go outside. Take your dog to the new area you want him to utilize. Walk him around the area until he defecates. If the dog is uncomfortable going on the leash, let him off and stand at the base of the porch steps to block entry. Wait until the dog goes to allow reentry to the porch or inside the house.
Use a lead line when the leash is not comfortable for your dog. Some dogs prefer privacy during the process. Set the lead line in an area away from the porch and leave your dog in privacy until he is finished. The lead allows him to roam while preventing him from getting on the porch.
Take the dog outside on a leash when he is ready and use temporary fencing to section off a chunk of the yard. Leave the dog in the area until he defecates. Watch the dog to ensure he is comfortable and does not attempt to escape the area. Continue this process until the dog naturally leads you to the area on the leash. Eventually you can remove the fencing and test the dog on his own.
Use a rewards system to condition the dog with positive feedback. Keep your dog's favorite treats handy when you go outside. Reward the dog with a treat and positive attention after each successful session. Continue using rewards and positive reinforcement until the dog uses the area without hesitation.