How To Stop My Dog Peeing On Rugs?

I have a 4 year old bichon cockapoo and he keeps peeing inside on the rugs. He knows its wrong and he’ll run away when he knows we’ve found it but we don’t know how to stop him. We have a large on in the family room that he pees on. He always goes outside for pees but he still continues to pee inside. The smell may have soaked through to the hardwood, if so what do you suggest to remove the smell? We’ve bought several new rugs, as he totally wrecks them by peeing on them- any suggestions as to how we can train him and how we can clean the rugs?