Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Preventing Apache from listing directory contents' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Preventing Apache from listing directory contents
Authored by: newbish on Jun 03, '03 09:26:59AM

Yes, Lou, there is a way!

Apache allows you to tell it what it can or cannot show when it is asked to serve a directory without any index page in it. The details for what else you can ask Apache to do in such a case can be found in the Apache manual. The URL on your computer will be:

http://127.0.0.1/manual/

The keyword will be "Indexing."

To stop index listings being created, here is the shortcut if you want it right away. First edit the Apache Configuration file, httpd.conf with:

sudo pico /etc/httpd/httpd.conf

And add this block of text to the end of the file:

# Don't allow any files in an index listing of the directory
<Directory /Library/WebServer/Documents/*>
IndexIgnore *
</Directory>
# end of index limiting

I think this will solve your problem in the shortrun. For more complex matters, you can use the indexing commands in Apache to actually point to a generic index.html should a directory not contain one.



[ Reply to This | # ]