Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an /uploads directory I wish to block from direct access. Of course I would put it outside the web root, but I'm really looking at a quick .htaccess fix.

Is there a way I can 403 or 404 a directory?

share|improve this question
add comment

migrated from stackoverflow.com Aug 19 '10 at 2:17

This question came from our site for professional and enthusiast programmers.

2 Answers

This will cause a 403 Forbidden message to be sent by the server:

order deny, allow
deny from all
share|improve this answer
add comment
up vote 2 down vote accepted

This seems to work. I put the following in /uploads/.htaccess

<LIMIT GET POST>
order deny,allow
deny from all
allow from none
</LIMIT>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.