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

Comments

  1. 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. 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. 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. 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. Great info. I think the main problem for most people is budgeting. It’s always about what you can afford.

  8. 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. 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. Your solution works great! Had a problem with the dreaded infinite loop on a new Web site on an Apache server. Thank you!

  11. I love this site

  12. 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

  13. 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 🙂

  14. 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?

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

  16. 2 potato

  17. HI,

    I need ur help.
    I had tried this code but just not working. Can anyone help in this. I want redirect all the domains to main domain

    All Domains need to be redirected to http://www.3pokerwin.com
    http://www.3pokerwin.co.nz
    http://www.3pokerwin.co.uk
    http://www.3pokerwin.co.za

    What is the code for this types of redirection? I have followed urs but not working. Can u help me out.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^3pokerwin.com [NC]
    RewriteRule ^(.*)$ http://www.3pokerwin.co.nz/$1 [L,R=301]

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

    • Lisa…make sure your website is hosted on a Linux server (not windows)
      and you have the .htaccess file uploaded to the server. Try redirecting one
      domain first to see if it’s successful before doing the next

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

      Let me know if you have success.

  18. Hi would you mind letting me know which web host you’re utilizing? I’ve
    loaded your blog in 3 completely different internet browsers and
    I must say this blog loads a lot quicker then most.
    Can you recommend a good internet hosting provider at a fair price?
    Cheers, I appreciate it!

  19. I leave a comment each time I like a post on a website or if I have something to contribute to the
    discussion. Usually it is caused by the sincerness
    communicated in the post I looked at. And after this post 301 Redirect
    for Multiple Domains. I was excited enough to drop a leave a responsea response
    🙂 I do have some questions for you if you usually do not mind.
    Is it just me or do a few of the remarks come across like written by brain dead people?
    😛 And, if you are writing on additional social sites,
    I would like to follow you. Would you make a list all of all your shared
    pages like your linkedin profile, Facebook page or twitter feed?

  20. This is actually applicable in my client’s case. I was researching on what’s the best thing to do when moving content to a site. The older domain has longer name reason for client to decide changing domain names but I have a less idea how to move the content properly. Thanks for sharing this post.

Trackbacks

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

  2. […] 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 […]

  3. pokerfilm says:

    pokerfilm…

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

Speak Your Mind

*