]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_dir.xml
02e62b25c05fc323a3f32946635f713b114a0d40
[apache] / docs / manual / mod / mod_dir.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <modulesynopsis metafile="mod_dir.xml.meta">
5 <name>mod_dir</name>
6 <description>Provides for "trailing slash" redirects and
7     serving directory index files</description>
8 <status>Base</status>
9 <sourcefile>mod_dir.c</sourcefile>
10 <identifier>dir_module</identifier>
11
12 <summary>
13     <p>The index of a directory can come from one of two sources:</p>
14
15     <ul>
16       <li>A file written by the user, typically called
17       <code>index.html</code>. The <directive module="mod_dir"
18       >DirectoryIndex</directive> directive sets the
19       name of this file. This is controlled by
20       <module>mod_dir</module>.</li>
21
22       <li>Otherwise, a listing generated by the server. This is
23       provided by <module>mod_autoindex</module>.</li>
24     </ul>
25     <p>The two functions are separated so that you can completely
26     remove (or replace) automatic index generation should you want
27     to.</p> 
28
29     <p>A "trailing slash" redirect is issued when the server
30     receives a request for a URL
31     <code>http://servername/foo/dirname</code> where
32     <code>dirname</code> is a directory. Directories require a
33     trailing slash, so <module>mod_dir</module> issues a redirect to
34     <code>http://servername/foo/dirname/</code>.</p>
35 </summary>
36
37 <directivesynopsis>
38 <name>DirectoryIndex</name>
39 <description>List of resources to look for when the client requests
40 a directory</description>
41 <syntax>DirectoryIndex
42     <var>local-url</var> [<var>local-url</var>] ...</syntax>
43 <default>DirectoryIndex index.html</default>
44 <contextlist><context>server config</context><context>virtual host</context>
45 <context>directory</context><context>.htaccess</context></contextlist>
46 <override>Indexes</override>
47
48 <usage>
49     <p>The <directive>DirectoryIndex</directive> directive sets the
50     list of resources to look for, when the client requests an index
51     of the directory by specifying a / at the end of the a directory
52     name.  <var>Local-url</var> is the (%-encoded) URL of a document on
53     the server relative to the requested directory; it is usually the
54     name of a file in the directory. Several URLs may be given, in
55     which case the server will return the first one that it finds.  If
56     none of the resources exist and the <code>Indexes</code> option is
57     set, the server will generate its own listing of the
58     directory.</p>
59
60     <example><title>Example</title>
61       DirectoryIndex index.html
62     </example>
63
64     <p>then a request for <code>http://myserver/docs/</code> would
65     return <code>http://myserver/docs/index.html</code> if it
66     exists, or would list the directory if it did not.</p>
67
68     <p>Note that the documents do not need to be relative to the
69     directory;</p>
70
71     <example>
72       DirectoryIndex index.html index.txt  /cgi-bin/index.pl
73     </example>
74
75     <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
76     executed if neither <code>index.html</code> or <code>index.txt</code>
77     existed in a directory.</p>
78 </usage>
79 </directivesynopsis>
80
81 </modulesynopsis>