Sunday, 15 March 2015

.htaccess - Can I specify a wildcard or regex as a Directory in htaccess? -



.htaccess - Can I specify a wildcard or regex as a Directory in htaccess? -

we have many, many sites, of contain "customer/uploadsfolder". have allow uploading, want block gif files, turn off php in folder shown below. question is, need 1 entry every folder, or can wildcards/regex used?

<virtualhost *:80> <directory /customer/uploadsfolder> deny <files ~ "^\w+\.(gif)$"> order deny,allow allow </files> <ifmodule mod_php5.c> php_flag engine off </ifmodule> </directory> </virtualhost>

yes, utilize locationmatch (or "location ~").

<locationmatch "\/customer\/uploadsfolder\/.*\.(php|gif)"> order allow,deny deny </locationmatch>

.htaccess

No comments:

Post a Comment