ellandrd
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/doma in.tld/ima ges">
Options All
AllowOverride All
Order allow,deny
deny from all
</Directory>
Please advise
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/doma
Options All
AllowOverride All
Order allow,deny
deny from all
</Directory>
Please advise
What does Apache log say when you try to access that URL?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.