summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_dir.xml
blob: cb830e9b3c65f0398fbf2fe2a435883a3feb9d94 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>

<!--
 Copyright 2002-2004 Apache Software Foundation

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_dir.xml.meta">
<name>mod_dir</name>
<description>Provides for "trailing slash" redirects and
    serving directory index files</description>
<status>Base</status>
<sourcefile>mod_dir.c</sourcefile>
<identifier>dir_module</identifier>

<summary>
    <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 <directive module="mod_dir"
      >DirectoryIndex</directive> directive sets the
      name of this file. This is controlled by
      <module>mod_dir</module>.</li>

      <li>Otherwise, a listing generated by the server. This is
      provided by <module>mod_autoindex</module>.</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 <module>mod_dir</module> issues a redirect to
    <code>http://servername/foo/dirname/</code>.</p>
</summary>

<directivesynopsis>
<name>DirectoryIndex</name>
<description>List of resources to look for when the client requests
a directory</description>
<syntax>DirectoryIndex
    <var>local-url</var> [<var>local-url</var>] ...</syntax>
<default>DirectoryIndex index.html</default>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context><context>.htaccess</context></contextlist>
<override>Indexes</override>

<usage>
    <p>The <directive>DirectoryIndex</directive> 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 directory
    name.  <var>Local-url</var> 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>

    <example><title>Example</title>
      DirectoryIndex index.html
    </example>

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

    <example>
      DirectoryIndex index.html index.txt  /cgi-bin/index.pl
    </example>

    <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>
</usage>
</directivesynopsis>

</modulesynopsis>