How to Prevent Directory Browsing?


#1

Hi,
I noticed that when I look at a directory on my site in the browser, and there isn’t an index.html in it, I can browse the contents of the entire directory. For example, if I type http://www.mysite.com/stuff/, I can see everything in /stuff

Is there any place where I can change this behavior, so a user can’t see everything in /stuff unless they knew the name of a page there? Sometimes, I don’t have any reason to put an index.html file in every folder.

Thanks.


#2

I’m behind a firewall right now and can’t view this page, but it claims to have the answer:
http://www.techiecorner.com/106/how-to-disable-directory-browsing-using-htaccess-apache-web-server/

It’s matter of putting an Options directive in your .htaccess file. If you do this at the root level of your domain (inside the example.com folder), it will prevent directory browsing in all of your directories.


#3

Scott,
Thanks for finding that article. I will try this when I am at home.


#4

Scott,
That did the trick. Thank you.