I own two domains. domain.com is for my main website, and anotherdomain.com is just a vanity URL. How can I forward users to domain.com when they type in anotherdomain.com while keeping anotherdomain.com in the URL bar? I have control of both domains and I don’t want to use an iframe. Is this possible?
Both domains are on the same server. To continue the example, the root for domain.com is /home/domain/ and the root for anotherdomain.com is /home/anothdom/
If you have control over both domains and they’re on the same server, and you want it so when you go to
anotherdomain.comit gets served content fromdomain.com, why not just change the document root to/home/domain?In the event that you need special content for one domain and not the other, you can do some simple routing with htaccess (by matching against
%{HTTP_HOST}).