mod_dir.html revision e0b181d3bfa99dfb992df3024b397660cb7afbe9
409N/A<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
50N/A XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
50N/A This file is generated from xml source: DO NOT EDIT
50N/A XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
50N/A --><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
50N/A 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>
50N/A <p>The index of a directory can come from one of two sources:</p>
50N/A
50N/A <ul>
50N/A <li>A file written by the user, typically called
50N/A <code>index.html</code>. The <a class="directive" href="#directoryindex"><code class="directive">DirectoryIndex</code></a> directive sets the
50N/A name of this file. This is controlled by
50N/A <code><a href="mod_dir.html">mod_dir</a></code>.</li>
50N/A
50N/A <li>Otherwise, a listing generated by the server. This is
50N/A provided by <code><a href="mod_autoindex.html">mod_autoindex</a></code>.</li>
50N/A </ul>
50N/A <p>The two functions are separated so that you can completely
50N/A remove (or replace) automatic index generation should you want
50N/A to.</p>
50N/A
50N/A <p>A "trailing slash" redirect is issued when the server
926N/A receives a request for a URL
886N/A <code>http://servername/foo/dirname</code> where
50N/A <code>dirname</code> is a directory. Directories require a
926N/A trailing slash, so <code><a href="mod_dir.html">mod_dir</a></code> issues a redirect to
50N/A <code>http://servername/foo/dirname/</code>.</p>
462N/A<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
717N/Aa directory</td></tr><tr><td><a class="help" href="directive-dict.html#Syntax">Syntax:</a></td><td>DirectoryIndex
1286N/A <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>
956N/A <p>The <code class="directive">DirectoryIndex</code> directive sets the
1231N/A list of resources to look for, when the client requests an index
565N/A of the directory by specifying a / at the end of the a directory
556N/A name. <em>Local-url</em> is the (%-encoded) URL of a document on
50N/A the server relative to the requested directory; it is usually the
516N/A name of a file in the directory. Several URLs may be given, in
1231N/A which case the server will return the first one that it finds. If
495N/A none of the resources exist and the <code>Indexes</code> option is
1231N/A set, the server will generate its own listing of the
584N/A directory.</p>
111N/A
384N/A<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Example</strong></p><code>
111N/ADirectoryIndex index.html
462N/A</code></td></tr></table></blockquote>
462N/A
462N/A <p>then a request for <code>http://myserver/docs/</code> would
462N/A return <code>http://myserver/docs/index.html</code> if it
462N/A exists, or would list the directory if it did not.</p>
462N/A
462N/A <p>Note that the documents do not need to be relative to the
50N/A directory;</p>
50N/A
50N/A<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>DirectoryIndex index.html index.txt /cgi-bin/index.pl</code></td></tr></table></blockquote>
50N/A <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
50N/A executed if neither <code>index.html</code> or
50N/A <code>index.txt</code> existed in a directory.</p>
50N/A<hr/></blockquote><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></body></html>