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 Link to comment https://forums.phpfreaks.com/topic/154195-redirecting-from-one-domain-to-another-htaccess/ 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. Link to comment https://forums.phpfreaks.com/topic/154195-redirecting-from-one-domain-to-another-htaccess/#findComment-810594 Share on other sites More sharing options...
ILMV Posted April 15, 2009 Author Share Posted April 15, 2009 That's pure genius! Many Thanks Link to comment https://forums.phpfreaks.com/topic/154195-redirecting-from-one-domain-to-another-htaccess/#findComment-810638 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.