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?

link|improve this question

55% accept rate
feedback

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
link|improve this answer
feedback
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>
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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