summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_dir.html.en
blob: e1e88c4134378b8450728731ae0678ae57284e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!-- 
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                This file is generated from xml source: DO NOT EDIT
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        --><title>mod_dir- Apache HTTP Server</title><link href="../style/manual.css" type="text/css" rel="stylesheet"/></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 cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Provides for "trailing slash" redirects and
    serving directory index files</td></tr><tr><td><a href="module-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="module-dict.html#ModuleIdentifier" class="help">Module&nbsp;Identifier:</a></td><td>dir_module</td></tr></table></td></tr></table><h2>Summary</h2>
    <p>The index of a directory can come from one of two sources:</p>

    <ul>
      <li>A file written by the user, typically called
      <code>index.html</code>. The <a href="#directoryindex" class="directive"><code class="directive">DirectoryIndex</code></a> directive sets the
      name of this file. This is controlled by
      <code><a href="mod_dir.html">mod_dir</a></code>.</li>

      <li>Otherwise, a listing generated by the server. This is
      provided by <code><a href="mod_autoindex.html">mod_autoindex</a></code>.</li>
    </ul>
    <p>The two functions are separated so that you can completely
    remove (or replace) automatic index generation should you want
    to.</p> 

    <p>A "trailing slash" redirect is issued when the server
    receives a request for a URL
    <code>http://servername/foo/dirname</code> where
    <code>dirname</code> is a directory. Directories require a
    trailing slash, so <code><a href="mod_dir.html">mod_dir</a></code> issues a redirect to
    <code>http://servername/foo/dirname/</code>.</p>
<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 cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td nowrap="nowrap"><strong>Description: </strong></td><td>List of resources to look for when the client requests
a directory</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>DirectoryIndex
    <em>local-url</em> [<em>local-url</em>] ...</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>DirectoryIndex index.html</code></td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Override" class="help">Override:</a></td><td>Indexes</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td nowrap="nowrap"><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_dir</td></tr></table></td></tr></table>
    <p>The <code class="directive">DirectoryIndex</code> directive sets the
    list of resources to look for, when the client requests an index
    of the directory by specifying a / 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, in
    which case the server will return the first one that it finds.  If
    none of the resources exist and the <code>Indexes</code> option is
    set, the server will generate its own listing of the
    directory.</p>

<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><p align="center"><strong>Example</strong></p><code>
DirectoryIndex index.html
</code></td></tr></table></blockquote>

    <p>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>

    <p>Note that the documents do not need to be relative to the
    directory;</p>

<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>DirectoryIndex index.html index.txt  /cgi-bin/index.pl</code></td></tr></table></blockquote>
    <p>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/></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>