mod_dir.html revision 3d76f0e292da6a107829fbe83f98b8c0985c6ddb
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--%hypertext -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<HTML>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<HEAD>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<TITLE>Apache module mod_dir</TITLE>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis</HEAD>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<BODY>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<IMG SRC="/images/apache_sub.gif" ALT="">
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--/%hypertext -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<H1>Module mod_dir</h1>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisThis module is contained in the <code>mod_dir.c</code> file, and
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisis compiled in by default. It provides for directory indexing.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<h2>Summary</h2>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisThis module controls the directory indexing. The index of a directory
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtiscan come from one of two sources:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<ul>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li>A file written by the user, typically called <code>index.html</code>.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisThe <A HREF="#directoryindex">DirectoryIndex</A> directive sets the name
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisof this file.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li>Otherwise, a listing generated by the server. The other directives
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtiscontrol the format of this listing. The <A HREF="#addicon">AddIcon</A>,
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A HREF="#addiconbyencoding">AddIconByEncoding</A> and
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A HREF="#addiconbytype">AddIconByType</A> are used to set a list of
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisicons to display for various file types; for each file listed, the
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisfirst icon listed that matches the file is displayed.
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis</ul>
ddc0e0b53c661f6e439e3b7072b3ef353eadb4afRichard Lowe
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--%hypertext -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<h2>Directives</h2>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<menu>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#adddescription">AddDescription</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#addicon">AddIcon</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#addiconbyencoding">AddIconByEncoding</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#addiconbytype">AddIconByType</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#defaulticon">DefaultIcon</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#directoryindex">DirectoryIndex</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#fancyindexing">FancyIndexing</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#headername">HeaderName</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#indexignore">IndexIgnore</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#indexoptions">IndexOptions</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<li><A HREF="#readmename">ReadmeName</A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis</menu>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<hr>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--/%hypertext -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A name="adddescription"><h2>AddDescription</h2></A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--%plaintext &lt;?INDEX {\tt AddDescription} directive&gt; -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Syntax:</strong> AddDescription <em>string file file...</em><br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<Strong>Override:</strong> Indexes<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Status:</strong> Base<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Module:</strong> mod_dir<p>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisThis sets the description to display for a file, for
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A HREF="#fancyindexing">FancyIndexing</A>. <em>File</em> is a file
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisextension, partial filename, wildcard expression or full filename for files
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisto describe. <em>String</em> is enclosed in double quotes
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis(<code>&quot;</code>). Example:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<blockquote><code>AddDescription "The planet Mars" /web/pics/mars.gif
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis</code></blockquote><p><hr>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A name="addicon"><h2>AddIcon</h2></A>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<!--%plaintext &lt;?INDEX {\tt AddIcon} directive&gt; -->
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Syntax:</strong> AddIcon <em>icon name name ...</em><br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<Strong>Override:</strong> Indexes<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Status:</strong> Base<br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<strong>Module:</strong> mod_dir<p>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisThis sets the icon to display next to a file ending in <em>name</em> for
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A HREF="#fancyindexing">FancyIndexing</A>. <em>Icon</em> is either a
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis(%-escaped) relative URL to the icon, or of the format
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis(<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag given
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisfor an icon for non-graphical browsers.<p>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<em>Name</em> is either ^^DIRECTORY^^ for directories, ^^BLANKICON^^ for
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisblank lines (to format the list correctly), a file extension, a wildcard
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtisexpression, a partial filename or a complete filename. Examples:
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<blockquote><code>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisAddIcon (IMG,/icons/image.xbm) .gif .jpg .xbm <br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisAddIcon /icons/dir.xbm ^^DIRECTORY^^ <br>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisAddIcon /icons/backup.xbm *~
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis</code></blockquote>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A HREF="#addiconbytype">AddIconByType</A> should be used in preference to
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr JasiukajtisAddIcon, when possible.<p><hr>
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis
25c28e83beb90e7c80452a7c818c5e6f73a07dc8Piotr Jasiukajtis<A name="addiconbyencoding"><h2>AddIconByEncoding</h2></A>
<!--%plaintext &lt;?INDEX {\tt AddIconByEncoding} directive&gt; -->
<strong>Syntax:</strong> AddIconByEncoding <em>icon mime-encoding mime-encoding
...</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
This sets the icon to display next to files with
<em>mime-encoding</em> for <A HREF="#fancyindexing">FancyIndexing</A>.
<em>Icon</em> is either a (%-escaped) relative URL to the icon, or of the
format (<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag
given for an icon for non-graphical browsers.<p>
<em>Mime-encoding</em> is a wildcard expression matching required the
content-encoding. Examples:
<blockquote><code>
AddIconByEncoding /icons/compress.xbm x-compress
</code></blockquote><p><hr>
<A name="addiconbytype"><h2>AddIconByType</h2></A>
<!--%plaintext &lt;?INDEX {\tt AddIconByType} directive&gt; -->
<strong>Syntax:</strong> AddIconByType <em>icon mime-type mime-type ...</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
This sets the icon to display next to files of type <em>mime-type</em> for
<A HREF="#fancyindexing">FancyIndexing</A>. <em>Icon</em> is either a
(%-escaped) relative URL to the icon, or of the format
(<em>alttext</em>,<em>url</em>) where <em>alttext</em> is the text tag given
for an icon for non-graphical browsers.<p>
<em>Mime-type</em> is a wildcard expression matching required the mime types.
Examples:
<blockquote><code>
AddIconByType (IMG,/icons/image.xbm) image/*
</code></blockquote><p><hr>
<A name="defaulticon"><h2>DefaultIcon</h2></A>
<!--%plaintext &lt;?INDEX {\tt DefaultIcon} directive&gt; -->
<strong>Syntax:</strong> DefaultIcon <em>url</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The DefaultIcon directive sets the icon to display for files when no
specific icon is known, for <A HREF="#fancyindexing">FancyIndexing</A>.
<em>Url</em> is a (%-escaped) relative URL to the icon. Examples:
<blockquote><code>
DefaultIcon /icon/unknown.xbm
</code></blockquote><p><hr>
<A name="directoryindex"><h2>DirectoryIndex</h2></A>
<!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
<strong>Syntax:</strong> DirectoryIndex <em>local-url local-url ...</em><br>
<strong>Default:</strong> <code>DirectoryIndex index.html</code><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The DirectoryIndex directive sets the list of resources to look for, when
the client requests an index of the directory by specifying a NULL file
at the end of the a directory name. <em>Local-url</em> is the (%-encoded) URL
of a document on the server relative to the requested directory; it is usually
the name of a file in the directory. Several URLs may be given; the server
will return the first one that it finds. If none of the resources exist,
then the server will generate its own listing of the directory.
Example:
<blockquote><code>
DirectoryIndex index.html
</code></blockquote>
then a request for <code>http://myserver/docs/</code> would return
<code>http://myserver/docs/index.html</code> if it exists, or would list
the directory if it did not. <p>
Note that the documents do not need to be relative to the directory;
<blockquote><code>
DirectoryIndex index.html index.txt /cgi-bin/index.pl</code></blockquote>
would cause the CGI script <code>/cgi-bin/index.pl</code> to be executed
if neither <code>index.html</code> or <code>index.txt</code> existed in
a directory.<p><hr>
<A name="fancyindexing"><h2>FancyIndexing</h2></A>
<!--%plaintext &lt;?INDEX {\tt FancyIndexing} directive&gt; -->
<strong>Syntax:</strong> FancyIndexing <em>boolean</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The FancyIndexing directive sets the FancyIndexing option for a directory.
<em>Boolean</em> can be <code>on</code> or <code>off</code>. The
<A HREF="#indexoptions">IndexOptions</A> directive should be used in
preference.<p><hr>
<A name="headername"><h2>HeaderName</h2></A>
<!--%plaintext &lt;?INDEX {\tt HeaderName} directive&gt; -->
<strong>Syntax:</strong> HeaderName <em>filename</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The HeaderName directive sets the name of the file that will be inserted
at the top of the index listing. <em>Filename</em> is the name of the file
to include, and is taken to be relative to the directory being indexed.
The server first attempts to include <em>filename</em><code>.html</code>
as an HTML document, otherwise it will include <em>filename</em> as plain
text. Example:
<blockquote><code>HeaderName HEADER</code></blockquote>
when indexing the directory <code>/web</code>, the server will first look for
the HTML file <code>/web/HEADER.html</code> and include it if found, otherwise
it will include the plain text file <code>/web/HEADER</code>, if it exists.
<p>See also <A HREF="#readmename">ReadmeName</A>.<p><hr>
<A name="indexignore"><h2>IndexIgnore</h2></A>
<!--%plaintext &lt;?INDEX {\tt IndexIgnore} directive&gt; -->
<strong>Syntax:</strong> IndexIgnore <em>file file ...</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The IndexIgnore directive adds to the list of files to hide when listing
a directory. <em>File</em> is a file extension, partial filename,
wildcard expression or full filename for files to ignore. Multiple
IndexIgnore directives add to the list, rather than the replacing the list
of ignored files. By default, the list contains `<code>.</code>'. Example:
<blockquote><code>
IndexIgnore README .htaccess *~
</code></blockquote><p><hr>
<A name="indexoptions"><h2>IndexOptions</h2></A>
<!--%plaintext &lt;?INDEX {\tt IndexOptions} directive&gt; -->
<strong>Syntax:</strong> IndexOptions <em>option option ...</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The IndexOptions directive specifies the behaviour of the directory indexing.
<em>Option</em> can be one of
<dl>
<dt>FancyIndexing
<dd><!--%plaintext &lt;?INDEX {\tt FancyIndexing} index option&gt; -->
This turns on fancy indexing of directories.
<dt>IconsAreLinks
<dd>
<!--%plaintext &lt;?INDEX {\tt IconsAreLinks} index option&gt; -->
This makes the icons part of the anchor for the filename, for
fancy indexing.
<dt>ScanHTMLTitles
<dd><!--%plaintext &lt;?INDEX {\tt ScanHTMLTitles} index option&gt; -->
This enables the extraction of the title from HTML documents for fancy
indexing. If the file does not have a description given by
<A HREF="#adddescription">AddDescription</A> then httpd will read the
document for the value of the TITLE tag. This is CPU and disk intensive.
<dt>SuppressLastModified
<dd>
<!--%plaintext &lt;?INDEX {\tt SuppressLastModified} index option&gt; -->
This will suppress the display of the last modification date, in fancy
indexing listings.
<dt>SuppressSize
<dd>
<!--%plaintext &lt;?INDEX {\tt SuppressSize} index option&gt; -->
This will suppress the file size in fancy indexing listings.
<dt>SuppressDescription
<dd>
<!--%plaintext &lt;?INDEX {\tt SuppressDescription} index option&gt; -->
This will suppress the file description in fancy indexing listings.
</dl>
This default is that no options are enabled. If multiple IndexOptions
could apply to a directory, then the most specific one is taken complete;
the options are not merged. For example:
<blockquote><code>
&lt;Directory /web/docs&gt; <br>
IndexOptions FancyIndexing <br>
&lt;/Directory&gt;<br>
&lt;Directory /web/docs/spec&gt; <br>
IndexOptions ScanHTMLTitles <br>
&lt;/Directory&gt;
</code></blockquote>
then only <code>ScanHTMLTitles</code> will be set for the /web/docs/spec
directory.<p><hr>
<A name="readmename"><h2>ReadmeName</h2></A>
<!--%plaintext &lt;?INDEX {\tt ReadmeName} directive&gt; -->
<strong>Syntax:</strong> ReadmeName <em>filename</em><br>
<Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
<Strong>Override:</strong> Indexes<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_dir<p>
The ReadmeName directive sets the name of the file that will be appended
to the end of the index listing. <em>Filename</em> is the name of the file
to include, and is taken to be relative to the directory being indexed.
The server first attempts to include <em>filename</em><code>.html</code>
as an HTML document, otherwise it will include <em>filename</em> as plain
text. Example:
<blockquote><code>ReadmeName README</code></blockquote>
when indexing the directory <code>/web</code>, the server will first look for
the HTML file <code>/web/README.html</code> and include it if found, otherwise
it will include the plain text file <code>/web/README</code>, if it exists.
<p>See also <A HREF="#headername">HeaderName</A>.<p>
<!--%hypertext -->
<hr>
<A HREF="../"><IMG SRC="/images/apache_home.gif" ALT="Home"></A>
<A HREF="./"><IMG SRC="/images/apache_index.gif" ALT="Index"></A>
</BODY>
</HTML>
<!--/%hypertext -->