2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $Revision: 1.9 $ -->
7 Copyright 2002-2004 The Apache Software Foundation
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
22 <modulesynopsis metafile="mod_dir.xml.meta">
24 <description>Provides for "trailing slash" redirects and
25 serving directory index files</description>
27 <sourcefile>mod_dir.c</sourcefile>
28 <identifier>dir_module</identifier>
31 <p>The index of a directory can come from one of two sources:</p>
34 <li>A file written by the user, typically called
35 <code>index.html</code>. The <directive module="mod_dir"
36 >DirectoryIndex</directive> directive sets the
37 name of this file. This is controlled by
38 <module>mod_dir</module>.</li>
40 <li>Otherwise, a listing generated by the server. This is
41 provided by <module>mod_autoindex</module>.</li>
43 <p>The two functions are separated so that you can completely
44 remove (or replace) automatic index generation should you want
47 <p>A "trailing slash" redirect is issued when the server
48 receives a request for a URL
49 <code>http://servername/foo/dirname</code> where
50 <code>dirname</code> is a directory. Directories require a
51 trailing slash, so <module>mod_dir</module> issues a redirect to
52 <code>http://servername/foo/dirname/</code>.</p>
56 <name>DirectoryIndex</name>
57 <description>List of resources to look for when the client requests
58 a directory</description>
59 <syntax>DirectoryIndex
60 <var>local-url</var> [<var>local-url</var>] ...</syntax>
61 <default>DirectoryIndex index.html</default>
62 <contextlist><context>server config</context><context>virtual host</context>
63 <context>directory</context><context>.htaccess</context></contextlist>
64 <override>Indexes</override>
67 <p>The <directive>DirectoryIndex</directive> directive sets the
68 list of resources to look for, when the client requests an index
69 of the directory by specifying a / at the end of the directory
70 name. <var>Local-url</var> is the (%-encoded) URL of a document on
71 the server relative to the requested directory; it is usually the
72 name of a file in the directory. Several URLs may be given, in
73 which case the server will return the first one that it finds. If
74 none of the resources exist and the <code>Indexes</code> option is
75 set, the server will generate its own listing of the
78 <example><title>Example</title>
79 DirectoryIndex index.html
82 <p>then a request for <code>http://myserver/docs/</code> would
83 return <code>http://myserver/docs/index.html</code> if it
84 exists, or would list the directory if it did not.</p>
86 <p>Note that the documents do not need to be relative to the
90 DirectoryIndex index.html index.txt /cgi-bin/index.pl
93 <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
94 executed if neither <code>index.html</code> or <code>index.txt</code>
95 existed in a directory.</p>