Forum Moderators: phranque

Message Too Old, No Replies

nginx to apache regex directymatch converstion

         

therealgtron

6:59 pm on Apr 23, 2009 (gmt 0)

10+ Year Member



this is to protect multiple directories in nginx. i need to make this work on a different apache server. if anyone could help convert it for me that would be great.

## Protect
location ~ /(director1/¦director2/¦director3/).* {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
deny all;
}

i looked at <DirectoryMatch> but i know i have it wrong.

## Protect
<DirectoryMatch "^/(director1/¦director2/¦director3/)">
Order Allow,Deny
Deny from all
</DirectoryMatch>

Caterham

9:01 pm on Apr 23, 2009 (gmt 0)

10+ Year Member



i looked at <DirectoryMatch> but i know i have it wrong.

Specify the path or is the path unknown?

<DirectoryMatch "^/var/www/folder/(director1¦director2¦director3)">

therealgtron

2:26 am on Apr 24, 2009 (gmt 0)

10+ Year Member



i seems directorymatch doesn't work in .htaccess. i don't want this in httpd.conf. i guess i'll have to think of something else.

jdMorgan

3:15 pm on Apr 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could put a "Deny from all" directive in a .htaccess file in each of those three directories.

Or you can enforce the access restriction based on the URL instead of the server filepath by using SetEnvIf and the "Deny from env=var" syntax.

Jim

therealgtron

4:32 pm on Apr 24, 2009 (gmt 0)

10+ Year Member



i'll give that a try. thanks, jim.