This is a discussion on .htaccess mod_rewrite 301 redirect help please? within the Web & Server Administration forums, part of the Web Designing & Development category; Hi, I have more than 1 domain name for my site, I want all variations of both (i.e. domain2.com, www.domain2.com, ...
Hi,
I have more than 1 domain name for my site, I want all variations of both (i.e. domain2.com, www.domain2.com, domain1.com) to point to www.domain1.com
this is what i have in my .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain2.com[NC]
RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain2.com[NC]
RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^domain1.com[NC]
RewriteRule ^(.*)$ http://www.domain1.com/$1 [R=301,L]
this does not appear to be working, anybody have any ideas what I might try?
(I also tried RewriteCond %{HTTP_HOST} ^domain2\.com[NC] -it does not seem to have made any difference)
thanks a lot.
the reason for doing a 301 redirect is so the search engines do not see it as multiple sites with duplicate content.
Bookmarks