mod_dir.html revision 240a5b8962329911d02566b600be6226e1f857ae
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic UpdaterXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic Updater This file is generated from xml source: DO NOT EDIT
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic UpdaterXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt--><title>mod_dir - Apache HTTP Server</title><link rel="stylesheet" type="text/css" href="/style/manual.css"/></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_dir</h1><table bgcolor="#cccccc" cellpadding="0" cellspacing="1"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Provides for "trailing slash" redirects and
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt serving directory index files</td></tr><tr><td><a class="help" href="module-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="module-dict.html#ModuleIdentifier">Module&nbsp;Identifier:</a></td><td>dir_module</td></tr></table></td></tr></table><h2>Summary</h2>
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic Updater <p>The index of a directory can come from one of two sources:</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <ul>
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic Updater <li>A file written by the user, typically called
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code>index.html</code>. The <a class="directive" href="#directoryindex"><code class="directive">DirectoryIndex</code></a> directive sets the
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt name of this file. This is controlled by
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code><a href="mod_dir.html">mod_dir</a></code>.</li>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <li>Otherwise, a listing generated by the server. This is
c6fb85f9500350e5ce58c9a24f5d264c8a8bd6f4Automatic Updater provided by <code><a href="mod_autoindex.html">mod_autoindex</a></code>.</li>
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater </ul>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <p>The two functions are separated so that you can completely
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt remove (or replace) automatic index generation should you want
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt to.</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater <p>A "trailing slash" redirect is issued when the server
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt receives a request for a URL
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code>http://servername/foo/dirname</code> where
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code>dirname</code> is a directory. Directories require a
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt trailing slash, so <code><a href="mod_dir.html">mod_dir</a></code> issues a redirect to
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code>http://servername/foo/dirname/</code>.</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt<h2>Directives</h2><ul><li><a href="#directoryindex">DirectoryIndex</a></li></ul><hr/><h2><a name="DirectoryIndex">DirectoryIndex</a> <a name="directoryindex">Directive</a></h2><table bgcolor="#cccccc" border="0" cellspacing="0" cellpadding="1"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>List of resources to look for when the client requests
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunta directory</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>DirectoryIndex
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <em>local-url</em> [<em>local-url</em>] ...</td></tr><tr><td><a class="help" href="directive-dict.html#Default">Default:</a></td><td><code>DirectoryIndex index.html</code></td></tr><tr><td><a class="help" href="directive-dict.html#Context">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a class="help" href="directive-dict.html#Override">Override:</a></td><td>Indexes</td></tr><tr><td><a class="help" href="directive-dict.html#Status">Status:</a></td><td>Base</td></tr><tr><td><a class="help" href="directive-dict.html#Module">Module:</a></td><td>mod_dir</td></tr></table></td></tr></table>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <p>The <code class="directive">DirectoryIndex</code> directive sets the
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt list of resources to look for, when the client requests an index
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt of the directory by specifying a / at the end of the a directory
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt name. <em>Local-url</em> is the (%-encoded) URL of a document on
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt the server relative to the requested directory; it is usually the
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt name of a file in the directory. Several URLs may be given, in
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt which case the server will return the first one that it finds. If
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt none of the resources exist and the <code>Indexes</code> option is
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt set, the server will generate its own listing of the
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt directory.</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Example</strong></p><code>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan HuntDirectoryIndex index.html
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt</code></td></tr></table></blockquote>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <p>then a request for <code>http://myserver/docs/</code> would
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt return <code>http://myserver/docs/index.html</code> if it
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt exists, or would list the directory if it did not.</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <p>Note that the documents do not need to be relative to the
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt directory;</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>DirectoryIndex index.html index.txt /cgi-bin/index.pl</code></td></tr></table></blockquote>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt executed if neither <code>index.html</code> or
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt <code>index.txt</code> existed in a directory.</p>
1bc5499c2a0fc5d2b11849e97cdd6305a64eb242Evan Hunt<hr/><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="/images/index.gif" alt="Index"/></a><a href="../"><img src="/images/home.gif" alt="Home"/></a></blockquote></body></html>