Apache directory listing settings

Apache Directory Listing

Apache directory listing

It is possible to let the webserver deliver a list of all files for a directory whenever a user navigates to it in the browser and there is no index file (f.e. index.html). The following Apache directory listing settings can achieve this behavior via entries in a .htaccess-file placed into the respective target folder.

Enable

Options +Indexes
# or
IndexIgnore *

Disable

If the user points to a directory where the directory listing is disabled and which have no index-file, he will get an 403 error.

Options -Indexes

Add additional information

To include file icons, file size, modification date and more information as well as sorting column headers:

IndexOptions +FancyIndexing

And you can disable fancy directory indexes via:

IndexOptions -FancyIndexing

Ignore files

To hide chosen files or file types in the directory index, you could use the following line (* wildcards are supported):

IndexIgnore *.zip *.txt

Change index filetype

You can force the apache to deliver another index-file than the standard one (index.html) by using the following snippet:

DirectoryIndex Home.html

One can also put a fallback order:

DirectoryIndex index.html index.php index.htm

Further information

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.