How do I stop Apache directory indexing?

paradoxchild

Registered
I have been looking through the Apache documentation concerning index options, but I have not been able to find what I am looking for. When I go to certain sites and enter a URL in the Address bar which doesn't directly refernce a file such as "http://www.press3.com/forums/" as opposed to "http://www.press3.com/forums/search.php", I still get a page instead of a directory index. How can I turn off Apache's directory indexing and have it instead look for a default file to display each time a directory listing is requested?

I didn't want to have to put an index.html in every subfolder, and I don't want Apache to give potential names incase I mistype an address (e.g. Try to access address "http://127.0.0.1/index.html.ja" which is not available and it gives me a list of available variants "index.html.ja.jis".)

Thanks in advance!:confused:
 
Hey!

Try adding this to httpd.conf:

<Location />
Options -Indexes
</Location>

That'll keep people from browsing your directories. Also, you might want to add a cutom error page for HTTP 403 - Forbidden. Otherwise the users trying to access a directory without an index.html will only get an ugly error message.

ErrorDocument 403 /some/error/document.html
 
Back
Top