Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

migrated from Aug 19 '10 at 2:17

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

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

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

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

order deny,allow
deny from all
allow from none
share|improve this answer

Your Answer


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.