Monday, July 11, 2016

apache 2.2 - Apache2: How do I restrict access to a directory, but allow access to one file within it?



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

Order Deny,allow
Deny from all

# But this file is OK:


Allow from all




But it's not working- it just blocks everything including the file I want to allow. Any suggestions?


Answer



There is an answer on StackOverflow that should answer this question, I think there is a missing Order in the nested Files directive?



https://stackoverflow.com/questions/6243677/apache-how-to-deny-directory-but-allow-one-file-in-that-dirctory



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...