2

What if you have two domain names: one is the name of the company, the other is the type of product the company sells, and you want viewers to access the site by either domain name, keeping the domain name they used in the address bar?

If you "park" one of the domain names, it seems that the hosting technology will roll it over to the primary domain. The result is that as a viewer browses the site a different domain than the one they typed is what shows in the address bar.

Is there a way to keep the domain name they entered for each URL on the site?

1

What you're trying to do is called Domain Masking. There are several ways to achieve this, but they are not easy.

There is a plugin in the repo that seems to be able to do content masking right from within the dashboard, but I have never tested it.

My initial intuition would be to do it using htaccess and apache's mod_rewrite module. You can see an example here, and there are plenty of similar questions/answers on stackechange which you can google.

  • The idea of domain masking seems like a two step process: 1. The server flips it to the "primary" domain 2. The masking covers up what the server did and shows the domain name that was used by the viewer. It seems like there should be a way to sever the same site with different domain names without that complexity. – Nora McDougall-Collins May 31 '18 at 14:40
  • No that's not possible, unless you have a web framework that allows you to set multiple domain names for the same site/content....but this is not possible with WordPress – Aurovrata May 31 '18 at 16:25
  • Yes, I have Googled the question. I have found many answers that are similar, but they tend toward having domains aimed at subdomains or individual directories within the file structure. – Nora McDougall-Collins Jun 1 '18 at 21:49
  • I wonder how it would work to take this code from your 4th link and just make the second domain rewrite to itself. #Redirect and keep everything after the URL #Visit yourdomainA.com/page and it will show the content from yourdomainB.com/page RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomainA.com RewriteRule ^(.*) yourdomainB.com/$1 [P] – Nora McDougall-Collins Jun 15 '18 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.