View Full Version : .htaccess rewrite to www.domain.com fails on one directory only

12-07-2010, 10:19 AM
I have a rewrite rule set up in my .htaccess file to redirect non www addresses to the www address:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

This works fine, but I discovered yesterday that the rewrite fails on my 'test' directory. Specifically mydomain.com/test is not redirected to www.mydomain.com/test. All other subdirectories are redirected fine.

I removed everything except the above statement from my .htaccess file but the problem remains.

This makes no sense to me....Any suggestions?

12-07-2010, 10:33 AM
Makes no sense to me either. Is there a test folder, and does it have a .htaccess? Are you certain there are no other .htaccess files in parent folders?

12-07-2010, 10:53 AM
Ah, that's it - there is (was) an .htaccess in test from ages ago. Never occurred to me. Thanks!