Text of httpd.apache.org › docs › trunk › mod › mod_autoindex.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

mod_autoindex - Apache HTTP Server Version 2.5

Modules | Directives | FAQ | Glossary | Sitemap | Report a bug Apache HTTP Server Version 2.5 Apache > HTTP Server > Documentation > Version 2.5 > Modules Apache Module mod_autoindex Available Languages: en | fr | ja | ko | tr Description: Generates directory indexes, automatically, similar to the Unix ls command or the Win32 dir shell command Status: Base Module Identifier: autoindex_module Source File: mod_autoindex.c Summary The index of a directory can come from one of two sources: A file located in that directory, typically called index.html .

The DirectoryIndex directive sets the name of the file or files to be used. This is controlled by mod_dir . Otherwise, a listing generated by the server. The other directives control the format of this listing. The AddIcon , AddIconByEncoding and AddIconByType are used to set a list of icons to display for various file types; for each file listed, the first icon listed that matches the file is displayed. These are controlled by mod_autoindex .

The two functions are separated so that you can completely remove (or replace) automatic index generation should you want to. Automatic index generation is enabled with using Options +Indexes . See the Options directive for more details. If the FancyIndexing option is given with the IndexOptions directive, the column headers are links that control the order of the display. If you select a header link, the listing will be regenerated, sorted by the values in that column.

Selecting the same header repeatedly toggles between ascending and descending order. These column header links are suppressed with the IndexOptions directive's SuppressColumnSorting option. Note that when the display is sorted by "Size", it's the actual size of the files that's used, not the displayed value - so a 1010-byte file will always be displayed before a 1011-byte file (if in ascending order) even though they both are shown as "1K".

Topics Autoindex Request Query Arguments Directives AddAlt AddAltByEncoding AddAltByType AddDescription AddIcon AddIconByEncoding AddIconByType DefaultIcon HeaderName IndexForbiddenReturn404 IndexHeadInsert IndexIgnore IndexIgnoreReset IndexOptions IndexOrderDefault IndexStyleSheet ReadmeName Bugfix checklist httpd changelog Known issues Report a bug Autoindex Request Query Arguments ¶ Various query string arguments are available to give the client some control over the ordering of the directory listing, as well as what files are listed.

If you do not wish to give the client this control, the IndexOptions IgnoreClient option disables that functionality. The column sorting headers themselves are self-referencing hyperlinks that add the sort query options shown below. Any option below may be added to any request for the directory resource. C=N sorts the directory by file name C=M sorts the directory by last-modified date, then file name C=S sorts the directory by size, then file name C=D sorts the directory by description, then file name O=A sorts the listing in Ascending Order O=D sorts the listing in Descending Order F=0 formats the listing as a simple list (not FancyIndexed) F=1 formats the listing as a FancyIndexed list F=2 formats the listing as an HTMLTable FancyIndexed list V=0 disables version sorting V=1 enables version sorting P= pattern lists only files matching the given pattern Note that the 'P'attern query argument is tested after the usual IndexIgnore directives are processed, and all file names are still subjected to the same criteria as any other autoindex listing.

The Query Arguments parser in mod_autoindex will stop abruptly when an unrecognized option is encountered. The Query Arguments must be well formed, according to the table above. The simple example below, which can be clipped and saved in a header.html file, illustrates these query options. Note that the unknown "X" argument, for the submit button, is listed last to assure the arguments are all parsed before mod_autoindex encounters the X=Go input.

Example <form action="" method="get"> Show me a <select name="F"> <option value="0"> Plain list</option> <option value="1" selected="selected"> Fancy list</option> <option value="2"> Table list</option> </select> Sorted by <select name="C"> <option value="N" selected="selected"> Name</option> <option value="M"> Date Modified</option> <option value="S"> Size</option> <option value="D"> Description</option> </select> <select name="O"> <option value="A" selected="selected"> Ascending</option> <option value="D"> Descending</option> </select> <select name="V"> <option value="0" selected="selected"> in Normal order</option> <option value="1"> in Version order</option> </select> Matching <input type="text" name="P" value="*" /> <input type="submit" name="X" value="Go" /> </form> AddAlt Directive ¶ Description: Alternate text to display for a file, instead of an icon selected by filename Syntax: AddAlt string file [ file ] ...

Context: server config, virtual host, directory, .htaccess Override: Indexes Status: Base Module: mod_autoindex AddAlt provides the alternate text to display for a file, instead of an icon, for FancyIndexing . File is a file extension, partial filename, wild-card expression or full filename for files to describe. If String contains any whitespace, you have to enclose it in quotes ( " or ' ). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon.

AddAlt "PDF file" *.pdf AddAlt Compressed *.gz *.zip *.Z AddAltByEncoding Directive ¶ Description: Alternate text to display for a file instead of an icon selected by MIME-encoding Syntax: AddAltByEncoding string MIME-encoding [ MIME-encoding ] ... Context: server config, virtual host, directory, .htaccess Override: Indexes Status: Base Module: mod_autoindex AddAltByEncoding provides the alternate text to display for a file, instead of an icon, for FancyIndexing .

MIME-encoding is a valid content-encoding, such as x-compress . If String contains any whitespace, you have to enclose it in quotes ( " or ' ). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon. AddAltByEncoding gzip x-gzip AddAltByType Directive ¶ Description: Alternate text to display for a file, instead of an icon selected by MIME content-type Syntax: AddAltByType string MIME-type [ MIME-type ] ...

Context: server config, virtual host, directory, .htaccess Override: Indexes Status: Base Module: mod_autoindex AddAltByType sets the alternate text to display for a file, instead of an icon, for FancyIndexing . MIME-type is a valid content-type, such as text/html . If String contains any whitespace, you have to enclose it in quotes ( " or ' ). This alternate text is displayed if the client is image-incapable, has image loading disabled, or fails to retrieve the icon.

AddAltByType 'plain text' text/plain AddDescription Directive ¶ Description: Description to display for a file Syntax: AddDescription string file [ file ] ... Context: server config, virtual host, directory, .htaccess Override: Indexes Status: Base Module: mod_autoindex This sets the description to display for a file, for FancyIndexing . File is a file extension, partial filename, wild-card expression or full filename for files to describe.

String is enclosed in double quotes ( " ). AddDescription "The planet Mars" mars.gif AddDescription "My friend Marshall" friends/mars.gif The typical, default description field is 23 bytes wide. 6 more bytes are added by the IndexOptions SuppressIcon option, 7 bytes are added by the IndexOptions SuppressSize option, and 19 bytes are added by the IndexOptions SuppressLastModified option. Therefore, the widest default the description column is ever assigned is 55 bytes.

Since the File argument may be a partial file name, please remember that a too-short partial filename may match unintended files. For example, le.html will match the file le.html but will also match the file example.htm

The rest of this page is on the live site.