Link to home
Start Free TrialLog in
Avatar of ellandrd
ellandrdFlag for Ireland

asked on

block root and subfolder using single .htaccess with deny/allow

Is it possible to restrict access to the root folder and a sub folder using one .htaccess? Using deny/allow?

I have one .htaccess file in the root which has:

order deny,allow
deny from all
allow from 127.0.0.1
allow from 127.0.0.2

This blocks access to the root for all IP addresses other than 127.0.0.1 and 127.0.0.2

However I would also like to block a subfolder but I can't add another .htaccess file to any sub folders but I get internal server error if I have this:

order deny,allow
deny from all
allow from 127.0.0.1
allow from 127.0.0.2

<Directory "/xxxx/xxxx/xxxx/xxxx/domain.tld/images">
Options All
AllowOverride All
Order allow,deny
deny from all
</Directory>

Please advise
Avatar of parparov
parparov
Flag of United States of America image

What does Apache log say when you try to access that URL?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to alter the order of your to allow, deny.
http://www.maxi-pedia.com/Order+allow+deny

If you are blocking/restricting access at the root, what additional restrictions are you placing down the road?

Where are you adding the extended directory?

use apachectl configtest to test the configuration file httpd.conf.