Forum Moderators: phranque

Message Too Old, No Replies

301 Mod_Rewrite.

Non WWW to WWW

         

Dayo_UK

12:36 pm on Feb 15, 2005 (gmt 0)



Hi

I am using the following in my htaccess file to change requests from domain.com to www.domain.com:-

RewriteCond %{HTTP_HOST}!^www\.domain\.co.uk
RewriteRule (.*) [domain.co.uk...] [R=301,L]

And this works fine for the selected domain.

However I have a seperate domain lets call it newdomain.co.uk that points to a directory in the redirected domain - www.domain.co.uk/new

Before I added the htaccess code requests for newdomain.co.uk worked fine and the url in the browser was newdomain.co.uk - now requests for (www.)newdomain.co.uk gets redirected to www.domain.co.uk/new

Anyone know where I am going wrong?

Funny thing is I have also got another domain pointing to www.domain.co.uk/newer and this has not been effected.

jdMorgan

11:44 pm on Feb 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code redirects any domain that is not equal to "www.domain.co.uk" to "www.domain.co.uk", regardless of what subdirectory is requested (since a subdirectory is not part of a domain name).

You need to modify your code to redirect only those domains that you want to redirect.

Jim