.htaccess: Deny from all

everactive
everactive used Ask the Experts™
on
Hello,

This is working:

<Files *.fileext>
      Order Allow,Deny
      Deny from all
</Files>

This is not:

<Files *.fileext|somedirectory>
      Order Allow,Deny
      Deny from all
</Files>

Please help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SteveNetwork Manager

Commented:
umm are you trying to protect the *.fileext in the /somedirectory folder ? or protect the somedirectory folder altogether ?

please explain what you are trying to protect..

Cheers
Network Manager
Commented:
you can use something like :

<Files ~ "\.(fileext|exe|...other_extensions...)$">
  order allow,deny
  deny from all
</Files>

in fact.. here is a site i use to setup complex htaccess rules.. check it out..

http://www.htpasswdgenerator.com/apache/htaccess.html



Commented:
Hello.

<DirectoryMatch "somedirectory">
  Order Allow,Deny
  Deny from all
</DirectoryMatch>

Hope it helps.

Commented:
Hi,

You can follow that structure:

DocumentRoot /var/www
<Directory /var/www>
    Allow from all
    Deny from none
    Order deny,allow
</Directory>
<Directory /var/www/*>
    Deny from all
</Directory>


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial