Here’s a list of (reportedly) the best carpet cleaners for pet urine.
https://www.mypetneedsthat.com/best-carpet-cleaner/
I don’t know what to recommend to stop the behavior, though. Does he always go in the same spot? If so, maybe you could put something (like a small table) over the spot temporarily so he can’t go there. It’s also possible he will stop as soon as you get rid of the smell. The smell probably makes him think it’s an acceptable area to use.