My company just migrated to WordPress and during the migration we were using a test domain (n.domain.com) to test and develop the new website.

After completion we switched the DNS from “n.domain.com” back to our original domain name of “www.our-updated-site.com.” Both domains are on the same server.

We recently discovered that Google has indexed many of the pages using the “n.domain.com” domain name.

I would like to know how to set up a RewriteRule in the .htaccess that would redirect any “n.domain.com” page to their “www.our-updated-site.com” counterpart?

Example:

from: n.domain.com/item-page/

to: www.our-updated-site.com/item-page/

and

from: n.domain.com/company-blog/blog-post-name/

to: www.our-updated-site.com/company-blog/blog-post-name/

Read more here: How to switch just the domain name but leave the url slug alone


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: