LevelTen Interactive

How To 301 Redirect Multiple Domains Into One Domain

Follow Me On Twitter
Problem: 

If you need to do a 301 redirect between multiple domain names, and force all domains to direct to the "www", use the following code in your .htaccess file.

RewriteCond %{HTTP_Host} ^(www\.)?secondary-domain1\.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [L,R=301]

RewriteCond %{HTTP_Host} ^(www\.)?secondary-domain2\.com$ [NC]
RewriteRule ^(.*)$ http://www.maindomain.com/$1 [L,R=301]

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

And that's how you would do a 301 redirect between multiple domain names, and force the "www" version of your main domain.  The code above is for a .htaccess file on an apache server.

Login or register to tag items
Syndicate content

©1999 - 2010 LevelTen Interactive - Dallas, TX