I just into a situation where I had to point multiple domains to the same website, but couldn’t do it the easy way.  Typically, I would just log into the domain’s registrar account like GoDaddy, manage into that domain, and select ‘forward this domain’.  But in this case, forwarding was not available through the domain’s registrar.

Currently I manage the hosting account through Web Host Manager, so here’s the steps for using WHM:

Step 1 – Setup Primary Account

  1. Point the ‘A’ record of the auxiliary domain to the same IP address as the primary domain
  2. Setup a standard cPanel account for the primary domain

Step 2 – Park Auxiliary Domains

  1. In WHM Select ‘Park a Domain’
  2. Select the primary domain from the list that you want to park the auxiliary domain on top of.
  3. Enter the auxiliary domain in the ‘Domain to Park’ field.
  4. Click ‘Submit’
  5. Repeat these steps in this section for all auxiliary domains

Now that that is done and the change is propagated, if you go to the auxiliary domain in your browser, it will show the same website files (since both domains are now using the same filespace) but the auxiliary domain name will still be in the address bar.  Although functional, this will not work for SEO purposes.  Google will most likely eventually find that the auxiliary website is an exact duplicate of the primary website and actually penalize you for it.  So as it so often does, .htaccess to the rescue!

Step 3 – Setup .htaccess Domain 301 Redirect

In short, copy/paste the following code into your .htaccess file.  It will automatically redirect any domain that does not match the primary domain to the primary domain by way of a 301 Redirect

Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} !^www\.newdomain\.com
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]