How to handle a site's migration when the new domain is on a shared IP address.
 by Kristi Hagen

How to handle a site's migration when the new domain is on a shared IP address.

  • When migrating a site, I know to point the old domain to the new domain's IP address. But, what if the new domain's IP address is shared with other websites on a single server? Will the .htaccess take care of that?

Answer:

There are several ways to go about this. The first choice is to see if you can "add" a domain to your account where your main website is hosted. If so, for each of your extra domains, add them to the main site and point them to the same file structure as the main site. Then you would update the DNS settings for the extra domains to what your host gives you to use. At this point, all the extra domains and the main site will all be sharing the same files, 100% duplicate content.

The .htaccess redirect is the key to making this work. It will say any request except for the primary domain redirects to the main domain. And it will look something like this,

RewriteEngine On
# If the hostname is NOT www.maindomain.com
RewriteCond %{HTTP_HOST} !^www\.maindomain\.com$
# 301 redirect to the same resource on www.maindomain.com
RewriteRule (.*) http://www.maindomain.com/$1 [L,R=301]

If your main site is https, make sure to address that as well. Planet Ocean article end

...

TO READ THE FULL ARTICLE