Jump to main content
University Computer Centre
Server Settings - Display of Directory Lists

Server Settings - Display of Directory Lists

With the Apache web server you can control the display of directories (= file folders). I.e. the author themselves can determine what is displayed for an URL that is pointing to a directory: A specific file (which one?) or a list (how?).

To do this, you have to create a file .htaccess in the relevant directory. This then also affects the subdirectories!

Displaying a File - Not a List

DirectoryIndex Relative-URL ...
Relative-URL is usually a file name in the directory. If more than one is specified, the first one found is sent. If there is no such file, an error will be displayed.
Standard: DirectoryIndex index.html index.htm index.php
Example:
.htaccess File in directory dir0 contains:
DirectoryIndex nolist.html
Result: .../dir0/

Displaying a File List

Options + Indexes
List all files (for download)
Standard: no list
Example: .htaccess - Result: .../dir1/

Appearance of the Directory List:

IndexOptions Options ...
The following options are available:
Fancyindexing - detailed directory list (icons, name, size, short description etc.)
SuppressLastModified - no indication of the last Modification time
SuppressSize - no indication of the file size
SuppressDescription - no indication of a short description
ScanHTMLTitles - HTML title as short description
Example:
.htaccess file in directory dir2 contains:
IndexOptions ScanHTMLTitles FancyIndexing SuppressLastModified
Result: .../dir2/
IndexIgnore file_name ...
Which files should not be listed (also patterns as in the shell with * or similar possible).
Standard: IndexIgnore /.?? *~ *.bak
Example:
.htaccess file in directory dir3 contains:
IndexIgnore *.gone
Result: .../dir3/ - files with the extension .gone are not displayed.
HeaderName file_name
ReadmeName file_name
Displaying a file content before and/or after the directory list. It has to be an HTML or text file (that means no image or similar). The content of <TITLE> cannot be influenced.
Standard:
HeaderName HEADER
ReadmeName README

Example:
.htaccess file in the directory dir4 contains:
HeaderName top.html
ReadmeName end.txt

Result: .../dir4/
AddDescription "Text" file_name
AddIcon (ALT,/path/to/icon) file_name
Specification of a short description or an icon for a file (or more at file name pattern). ALT is a string for ASCII browser <IMG ALT=...>. Furthermore AddIconByEncoding, AddIconByType, DefaultIcon are posssible.
Standard:
no description, standard icon set
Example:
.htaccess file in directory dir5 contains
IndexOptions FancyIndexing
AddDescription "For demonstration only" *.gif
AddIcon (IMG,/Images/anim/new.gif) 1.gif
DefaultIcon /icons/blank.gif

Result: .../dir5/

Further information: Apache documentation