http 301 redirection issue
- by Guilhem Soulas
I'm a little bit lost with a redirection.
I want mysite.com, www.mysite.com and www.mysite.co.uk to redirect to mysite.co.uk.
In Apache, I wrote this for mysite.co.uk in order to redirect www to the root domain:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www
RewriteRule ^/(.*) http://mysite.co.uk/$1 [L,R=301]
And for mysite.com, I wrote this redirect to mysite.co.uk:
ServerName www.mysite.com
RewriteEngine on
RewriteRule ^/(.*) http://mysite.co.uk/$1 [L,R=301]
This way, I can make the redirection work properly from www.mysite.com to mysite.co.uk, but it doesn't work for mysite.com too mysite.co.uk (without the www) at the same time. Could someone tell me how to make all my redirections work in all cases?