View Full Version : 301 .htaccess rewrite rules

10 Dec 2009, 08:08 AM
I am after a 301 redirect and have my .htaccess directive set as follows

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.co.uk [NC]
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ http://www.domain.com/$1?%1 [R=301]

notice its catching all .co.uk requests and redirecting to .com (appending any querystring to the new domain of course)

So the question is can i do this when dealing with multiple 301's pointing and resolving to one marketed domain or do i have to have a Rewrite Rule in for each directive...

#RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com [NC]
#RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.co.uk [NC]
#RewriteCond %{HTTP_HOST} ^(www\.)?domain3\.co.uk [NC]
#RewriteCond %{QUERY_STRING} ^(.*)$
#RewriteRule ^(.*)$ http://www.eaga.com/$1?%1 [R=301]

11 Dec 2009, 11:18 AM
i think your send this thead in wrong section..