Redirect all pages from one domain to another

I have seen several questions about 301 redirects from one domain to another. This question refers to something of a special situation.

I have a website domain1.com which is points to /public_html/sitehosting

Read More

For several reasons, which I won’t get into now, we have decided to move the site to a new domain domain2.com which is also mapped to /public_html/sitehosting

How can I create a 301 redirect so that all domain1.com URLs are redirected to exactly similar URLs on domain2.com?

We would like this redirect so as to preserve Google PR juice…domain1.com has a pretty good pagerank. When domain1.com expires in about 6 months, we don’t plan to renew it.

P.S. I’m using WordPress with “seo” permalinks.

P.P.S. I understand that because both domains are mapped to the same folder, so any domain1.com URL will lead to the same content. But will PR juice be transferred to domain2.com this way?

Related posts

Leave a Reply

1 comment

  1. Put this code in your .htaccess under DOCUMENT_ROOT directory before your regular wordpress code:

    RewriteCond %{HTTP_HOST} ^(www.)?domain1.com$ [NC]
    RewriteRule ^ http://domain2.com%{REQUEST_URI} [R=301,L]