Modifying directory indexes

What are directory indexes?
If the Indexes option is enabled (which it is by default), visitors can look inside any directory that does not have an index.html (or index.php, etc.) file in it and browse the contents of the directory. This is probably not the behaviour you typically want, especially if said directory contains something like script configuration files and other things that might be useful to... less benevolent folks on the Internet.

One way around this problem is to put an empty index.html in every single folder of your site, but for sites with a large hierarchy of directory structure, this can quickly become very tedious. Fortunately, there's a better way... using the magic of .htaccess!

Turning off directory indexes
Place the following in an .htaccess file in your main domain name folder to disable directory indexes throughout your entire site:

Options -Indexes

That's it! Now, if someone tries to browse the contents of any directory of your site, they'll get a big nasty 403 (Forbidden) error.

Turning on directory indexes
But suppose there's a particular directory in your site that you *do* want people to be able to browse (a folder containing photos of your escapades at the last Pink Floyd concert, perhaps).

Simply create a new .htaccess file inside the folder you want to be browsable, containing:

Options +Indexes

This will now override the "global" setting and allow users to view all your of embarr... I mean of course *wholesome*... photos in that single directory.

You can also add the AddDescription directive for the php4 directory and your music files : AddDescription "Php documentation" php4 AddDescription "Miousic" .wav .mp3 .WAV .MP3 .ogg .OGG .AI .ai. In order to hide the LastModified and Size columns, you can add an other directive : IndexOptions FancyIndexing SuppressLastModified SuppressSize. The IndexIgnore directive allows you to choose files that must be hidden or not : IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t \ Desktop.ini *lnk *LNK \ perso RECYCLER "System Volume Information" my.file Backslashes are used against carriage return in order to makes a pleasant reading of the section.

What is and isn't disabled
Specifying  disables server-generated directory listings. It does not disable the use of directory URLs when there is an index page in that directory.

For example, if you have  in your , but you have a file called   in the directory  , then your users can visit the URL   and they will see the contents of.

Dot files
Q: I want to make .emacs, .muttrc etc. visible in an index

A: Sorry, cannot do. See https://issues.apache.org/bugzilla/show_bug.cgi?id=24243