Rule not redirecting .co.uk to .com

Posted by bateman_ap on Stack Overflow See other posts from Stack Overflow or by bateman_ap
Published on 2011-11-14T15:56:22Z Indexed on 2011/11/16 9:51 UTC
Read the original article Hit count: 393

Filed under:
|
|

I have been trying to get my site, when a visitor goes to .co.uk to be automatically redirected to .com. As well as if they go to domain.com to be taken to www.domain.com

I have the code below in my httpd.conf, it appears to be working with domain.com to www.domain.com but not domain.co.uk or www.domain.co.uk to www.domain.com

RewriteEngine on
RewriteBase /      
RewriteCond %{http_host} ^domain.com [NC,OR]
RewriteCond %{http_host} ^domain.co.uk [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]

© Stack Overflow or respective owner

Related posts about apache

Related posts about mod-rewrite