Forum Moderators: coopster & phranque

Message Too Old, No Replies

domain redirect

having trouble redirecting from one domain to another

         

dawlish

4:23 pm on Jan 3, 2002 (gmt 0)

10+ Year Member



Essentially I have two domains www.domain.com and www.domain.co.uk both pointing to the same ip and configured on the server.

However could anyone offer any advice as to how I can ensure that anyone entering www.domain.co.uk or www.domain.co.uk/whatever/ into the browser is redirected to www.domain.com or www.domain.com/whatever/ instead.

I was advised to add the following my server httpd.conf file

<VirtualHost 111.111.111.111>
Servername www.domain.com
ServerAlias www.domain.co.uk domain.co.uk
</VirtualHost>

This works fine if you try and access the site without a trailing slash e.g www.domain.co.uk/folder redirects to www.domain.com/folder However if you add a trailing slash e.g www.domain.co.uk/folder/ then the redirect doesn't happen.

I have also tried adding the following instead:
<VirtualHost 111.11.111.111>
Servername www.domain.co.uk
ServerAlias www.domain.co.uk
RedirectPermanent / [domain.com...]
</VirtualHost>

In this instance if you enter www.domain.co.uk you are successfully redirected if you enter anything else e.g www.domain.co.uk/folder then you get a 404.

Any help much appreciated.

bobriggs

4:42 pm on Jan 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you try this?

RedirectPermanent / [domain.com...]

Note trailing slash.

dawlish

5:19 pm on Jan 3, 2002 (gmt 0)

10+ Year Member



Thanks!