Our male dog had an issue where he peed in the house for a while after being housetrained and we used an enzyme spray that broke down the urine. He couldn't smell it so he wouldn't pee there again which was a big help. I think the brand was Nature's Miracle if I remember correctly. But these ideas should help as well:
https://www.wikihow.com/Get-Dog-Urin...out-of-Carpets