I have a main hosting registered with the domain example.com. The hosting allows me to park another domain. I want that any person that access to example2.com be redirected to sub.example.com. In this way:the user access to:               example2.com/something/a.htmlThe user sees the content of:     sub.example.com/something/a.htmlAnd the browser displays:         example2.com/something/a.htmlI tried to do a CNAME from example2.com to sub.example.com but the pages go to example.com. I think that is because the domain is parked at that hosting.When I get that done, how I ensure that Google displays example2.com and not the other subdomain?
How to redirect parked domain to main domain but still show the parked domain in address bar
redirects;subdomain
You could look into doing a frame redirect.   It is also sometimes called web forwarding or masked redirect.   In that case the redirect server issues content like this:<html><frameset rows=100%,* border=0><frame src=http://www.example.com/my-page.html noresize frameborder=0></frameset></html>This causes the browser to show the contents of your main site, but the URL will show the redirect domain.This type of redirect is not ideal:The URL doesn't change as the user browses around the siteIt breaks bookmarking functionalityThe other option is to fully duplicate the content and fully host two different domains that have all the same pages on them.