301 Redirect for Multiple Domains

If you want to redirect several domains to your main web site, you need to use a 301 redirect placed inside the .htaccess file on your server.

Definition of 301 Redirect

A 301 redirect tells web browsers and search engines that a web page(s) or web site(s) has been permanently moved to a new location. The 301 redirect code includes the web site address to which the resource has been moved. Web browsers will automatically redirect the person to the new location.

When to use 301 Redirect

A 301 redirect should be used to move a web site to a new domain name (URL). Search engines will preserve the search engine rankings the web site had at the previous domain.

Requirements

Apache server (the 301 redirect described will only work on apache servers. Most servers used to host web sites these days run apache.

.htaccess file – this file contains the 301 redirect code and must be placed in the root folder of your server (same location as the inidex.html page)

Same DNS- all domains you wish to redirect should have the same DNS information.

Parked domains – all domains you wish to redirect should be parked on top of your main web site.

301 Redirect Code for redirecting Multiple Domains


Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www.domain.com[NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

1. First block you need once only.

2. Second block: you need one for each domain.com that needs redirecting.

3. Third block: you need one for each www.domain.com that needs redirecting to www.newdomain.com.

4. Remove all of the blank lines from the above example.

5. Place all code in the .htaccess file in the web root folder.
Check if there is any code in the .htaccess file already as you may overwrite it. If there is, place the 301 redirect code
under this code.

6. Upload file to server – place the .htacess access in the public_html folder or the same folder as your home page.

7. All redirected domains should be parked on top of your main web site. You can usually do this from within the cpanel
that comes with your hosting plan.

8. Prevent duplicate content issues by redirecting all non-www domains to http://www.domain.com/


RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

These domain name variations:

domain.com

http://domain.com

www.domain.com

will now get redirected to http://www.domain.com/

9. Redirect www.domain.com/index.html to http://www.domain.com/
Within your web site navigation structure, you often have pages linking to the home page with the file name: www.domain.com/index.html. This will also cause duplicate content issues. Use the code below to redirect to your main URL…http://www.domain.com/


RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.(html?|php|asp|cfm)\ HTTP/
RewriteRule ^(.*)index\.(html?|php|asp|cfm)$ http://www.domain.com/$1 [R=301,L]

Tips

All spaces in the code are exact and important.
Make sure you copy and paste the code correctly.
Be sure to include a space before each [NC]

The code shown above must go before the other redirects otherwise it will create a redirection chain.

Conclusion

Now your web site can be accessed using multiple domains. The 301 redirect code used above prevents your web site from being accessed by both domain.com and at www.domain.com for each page of the site. If you did not use the 301 redirect code, Google would spider and index them both, treat them as duplicate content and then penalise one version of each page.

By creating the 301 redirect from non-www to www for each domain, only www will be indexed. If you own both a .co.uk and a .com you would redirect everything to www.domain.com if you wanted to be found globally; or if you want to rank well in UK results but are hosted outside the UK, you would redirect everything to www.domain.co.uk.

Resources

301 Redirects for multiple domains

How to Redirect a Web Page Using a 301 Redirect

20 Responses to “301 Redirect for Multiple Domains”

  1. dave cohen Says:

    Great article! I’m working on building a new site for a company – with cart, cc gateway, ssl, etc. However, there is an existing site on another host. In order to reduce problems and downtime, my solution is to set up new domain and get new site ready, then move/park the old domain name with redirect to new domain. The only issue I’m weighing is, do users care/notice that their entered url address was redirected from the site they requested?

  2. Herman Says:

    Hi Dave,

    Users will soon know the new URL after visiting several times. Don’t worry.

  3. David from Florence Says:

    Hi !

    I have three domain names registered with Networksolutions.

    I redirected them to three respective pages in another website I have in another server.

    Is this considered spamming by search engines ?

    Thank you.

    David.

  4. David from Florence Says:

    Ps: to redirect the domain names, I use the option offered by Network solution called “Web forwarding”.

    Is this “clean” ?

  5. Sarah Henery Says:

    David,

    I have a few domains with network solutions, and I just used this code to 301 redirect my pages and it works great (having an issue with the ^domain.com redirecting, though).

    Anyway, you need to employ this code as well as the “web forwarding.” The “Web forwarding” is basically just parking the domain. You need to add this code as well – you can add the code to your htaccess file by going to your account manager by logging in to http://www.networksolutions.com then click on “Web Hosting” then “Manage Web Hosting”. Click on your main domain name (the one that the others point to), and then under “Web Hosting” on the left, the option “Toolbox” will pop up. Click on the tool box, and when the new page appears, click on “File Manager” Once you get in to the file manager, open the htdocs folder and the htaccess file will be under there.

    You can modify the code above to redirect your parked domains to the specific pages you want them to go to ….

    Here’s one that I did:

    RewriteCond %{HTTP_HOST} ^www.yorkieshampoo.com[NC]
    RewriteRule ^(.*)$ http://www.yorkiesllc.com/yorkiesplash.html/$1 [L,R=301]

  6. steve Says:

    Hi

    I used this code and it works greate . but after using this , when i enter mydomain.com/myfolder , the browser redirects to http://www.mydomain.com/401.shtml and a 404 error accures . but where i enter http://www.mydomain.com/myfolder this works

    can u tell me why ?!

  7. Rafael Ehrhardt Says:

    Great info. I think the main problem for most people is budgeting. It’s always about what you can afford.

  8. giannakos Says:

    Dear friends,

    In general terms is it good to have multiple-domains redirecting to a single account by using 01 redirect code ? does this gives you increased traffic ?

    So if a customer ask me:

    “if i buy 4-5 domains redirecting to the same website is this beneficial for me to increase my visitors and my rates in Google ?”

    what should i answer him ?

    best regards

    giannakos

  9. Herman Says:

    One case where this could be used is when you purchase a .com name as your main address then purchase .org .us .net .info and redirect them to .com.

    Redirecting several domains won’t increase traffic unless each of these domains has a web site that already attracts traffic.

    Search engines prefer to see a real website with a domain rather than a bunch of redirects.

  10. Michigan web designer Says:

    Your solution works great! Had a problem with the dreaded infinite loop on a new Web site on an Apache server. Thank you!

  11. samuel Says:

    2PAueF http://www.cRk2bdPqQls602mIa4bgo.com

  12. Hwucvncu Says:

    I love this site

  13. chips zynga Says:

    although I pass a large amount of of my day on the internet enjoying online games like zynga poker or mafia wars, I nonetheless like to take some spare time to compare a number of blogs now and then and I am proud to report this most recent information is frankly quite good quality and drastically superior than half the various waste I read today , anyways i’m off to enjoy a few rounds of zynga poker

  14. myspace chips Says:

    i’m often bouncing all across the internet almost all of the time which means I possess a tendency to read considerably, which unfortunately is not commonly a beneficial factor as several of the sites I find are made up of unproductive crap copied from some other internet sites a million times, nevertheless I have to compliment you because this website is really readable and contains a bit of original information, for that reason cheers for breaking the phenomena of merely replicating other individual’s websites, in case you ever wanna have fun with a couple of hands of myspace poker together with me just shout out – you have my e-mail :)

  15. SEO and Social Media Says:

    Great article on 301s have learnt from it, but I was wondering if I have 4 domains from different sources and I want to link them up to one site will ranks be passed accross with the 301?

  16. Hearing Treatment Says:

    Definitely, what a fantastic website and instructive posts, I surely will bookmark your website.Have an awsome day!

  17. 301 Redirect – How to Redirect a Website or Web Page Says:

    [...] Articles 301 Redirect for Multiple Domains How to Redirect a Web Page Using a 301 [...]

  18. How To 301 Redirect Dynamic URLS Says:

    [...] Articles How to Redirect a Website or Web Page and Preserve Your Rankings 301 Redirect for Multiple Domains How to Redirect a Web Page Using a 301 Redirect 301 Redirect PHP – How to redirect a PHP page or [...]

  19. pokerfilm Says:

    pokerfilm…

    [...]301 Redirect for Multiple Domains[...]…

  20. website Says:

    2 potato

Leave a Reply