ILMV Posted April 15, 2009 Share Posted April 15, 2009 Hello All I already have a Rewrite rule within my htaccess to ensure that the URL always has a www infront. Now I have two web addresses for this domain, one .co.uk address and a .com. I always want to use the .com address, so if people com in using .co.uk, how can I redirect them using htaccess. I have had a look at RewriteCond etc but I cannot understand them. Many Thanks, ILMV Quote Link to comment Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 15, 2009 Share Posted April 15, 2009 RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] RewriteRule ^(.*)$ http://www.mysite.com%{REQUEST_URI} [L,R=301] Anything that's not www.mysite.com will be redirected to www.mysite.com using a SEO friendly 301. Quote Link to comment Share on other sites More sharing options...
ILMV Posted April 15, 2009 Author Share Posted April 15, 2009 That's pure genius! Many Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.