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.

With .htaccess, how can I block access to any sub-directories (and its contents) when they are accessed directly (using the browser's address bar for example)?

I'm on a shared host, so I do not have access to the main httpd.conf file. I realize I can simply put a file with "Deny from all" inside the sub-directories, but I'd like to do it from my single root .htaccess file.

share|improve this question

migrated from stackoverflow.com Oct 11 '11 at 11:22

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

1 Answer 1

<Directory /var/www/*>
     Order Deny,Allow
     Deny from All
</Directory> 

<Directory /var/www/>
     Order Allow,Deny
     Allow from All
</Directory> 

Just a hunch, haven't tested it.

share|improve this answer

Your Answer

 
discard

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