Forum Moderators: phranque

Message Too Old, No Replies

Having Folders inherit the .htaccess commands

         

bears5122

10:19 pm on May 30, 2005 (gmt 0)

10+ Year Member



I'm doing something fairly simple, which is running a 301 of all non-www pages to the www version.

I'm using this code in the .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule (.*) [mysite.com...] [R=301,L]

It works great on everything on the site. The problem is that it doesn't work on the root file in a particular folder. Here is an example on what it works with:

WORKS ON
[mysite.com...]
[mysite.com...]

DOESN'T WORK ON
[mysite.com...]

Does anyone have a quick fix for this? I'm a tad confused at why this isn't working.

sitz

11:02 pm on May 30, 2005 (gmt 0)

10+ Year Member



when testing things like this, I always recommend cranking up the RewriteLogLevel [httpd.apache.org] to 9, setting the RewriteLog [httpd.apache.org], and testing it that way. Of course, this assumes that you have write access to httpd.conf; if you don't have such access, I'd suggest installing Apache on a test system which will allow you to have such access.

FWIW, one potential cause is that mod_autoindex [httpd.apache.org] a) is active and b) appears after mod_rewrite in the httpd.conf file.

bears5122

2:54 am on May 31, 2005 (gmt 0)

10+ Year Member



Thanks for the help. I actually had it right the first time. I think I had an old DNS cached.