Apache2: How do I restrict access to a directory, but allow access to one file within it?
Posted
by
Nick
on Server Fault
See other posts from Server Fault
or by Nick
Published on 2010-08-26T09:31:24Z
Indexed on
2011/01/03
11:55 UTC
Read the original article
Hit count: 192
I've inherited a poorly designed web app, which has a certain file that needs to be publicly accessible, but that file is inside a directory which should not.
In other words, I need a way to block all files and sub-directories within a directory, but over-ride it for a single file.
I'm trying this:
# No one needs to access this directly
<Directory /var/www/DangerousDirectory/>
Order Deny,allow
Deny from all
# But this file is OK:
<Files /var/www/DangerousDirectory/SafeFile.html>
Allow from all
</Files>
</Directory>
But it's not working- it just blocks everything including the file I want to allow. Any suggestions?
© Server Fault or respective owner