Forum Moderators: phranque

Message Too Old, No Replies

Getting RewriteRule in .htaccess *above* the root level to match files

RewriteRule ^cgi - [F,L] doesn't work above the root

         

MichaelBluejay

10:08 am on Dec 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This works fine when my .htaccess is at the top level of my web directory:

RewriteRule ^(cgi¦CGI)[/-] - [F,L]

But if I put it one level higher (i.e., /home/user/ instead of /home/user/domain.com/), then it fails to match files.

The reason I want it up so high is that it controls all the folders below it, and I have about six domains in that user's folder that I want to control, so I don't have to always edit six different .htaccess files separately

jdMorgan

3:14 pm on Dec 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try adding the path to the Web-accessible directory level, in this case, a single leading slash.

RewriteRule [b]^/c[/b]gi[/-] - [NC,F]

Jim

MichaelBluejay

2:29 am on Dec 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm afraid that didn't work. (Failed to match.)

Oddly, Redirect will work, but not RewiteRule, e.g.

Redirect 301 /logs http://example.com/admin/logs.cgi