upload http
[bottlenecks.git] / rubbos / app / httpd-2.0.64 / docs / manual / mod / mod_dir.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_dir - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.0</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.0</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_dir</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_dir.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
26 <a href="../ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
27 <a href="../tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
28 </div>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for "trailing slash" redirects and
30     serving directory index files</td></tr>
31 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
32 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>dir_module</td></tr>
33 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_dir.c</td></tr></table>
34 <h3>Summary</h3>
35
36     <p>The index of a directory can come from one of two sources:</p>
37
38     <ul>
39       <li>A file written by the user, typically called
40       <code>index.html</code>. The <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> directive sets the
41       name of this file. This is controlled by
42       <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code>.</li>
43
44       <li>Otherwise, a listing generated by the server. This is
45       provided by <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code>.</li>
46     </ul>
47     <p>The two functions are separated so that you can completely
48     remove (or replace) automatic index generation should you want
49     to.</p> 
50
51     <p>A "trailing slash" redirect is issued when the server
52     receives a request for a URL
53     <code>http://servername/foo/dirname</code> where
54     <code>dirname</code> is a directory. Directories require a
55     trailing slash, so <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> issues a redirect to
56     <code>http://servername/foo/dirname/</code>.</p>
57 </div>
58 <div id="quickview"><h3 class="directives">Directives</h3>
59 <ul id="toc">
60 <li><img alt="" src="../images/down.gif" /> <a href="#directoryindex">DirectoryIndex</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#directoryslash">DirectorySlash</a></li>
62 </ul>
63 </div>
64
65 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
66 <div class="directive-section"><h2><a name="DirectoryIndex" id="DirectoryIndex">DirectoryIndex</a> <a name="directoryindex" id="directoryindex">Directive</a></h2>
67 <table class="directive">
68 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>List of resources to look for when the client requests
69 a directory</td></tr>
70 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectoryIndex
71     <var>local-url</var> [<var>local-url</var>] ...</code></td></tr>
72 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectoryIndex index.html</code></td></tr>
73 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
74 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
75 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
76 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
77 </table>
78     <p>The <code class="directive">DirectoryIndex</code> directive sets the
79     list of resources to look for, when the client requests an index
80     of the directory by specifying a / at the end of the directory
81     name.  <var>Local-url</var> is the (%-encoded) URL of a document on
82     the server relative to the requested directory; it is usually the
83     name of a file in the directory. Several URLs may be given, in
84     which case the server will return the first one that it finds.  If
85     none of the resources exist and the <code>Indexes</code> option is
86     set, the server will generate its own listing of the
87     directory.</p>
88
89     <div class="example"><h3>Example</h3><p><code>
90       DirectoryIndex index.html
91     </code></p></div>
92
93     <p>then a request for <code>http://myserver/docs/</code> would
94     return <code>http://myserver/docs/index.html</code> if it
95     exists, or would list the directory if it did not.</p>
96
97     <p>Note that the documents do not need to be relative to the
98     directory;</p>
99
100     <div class="example"><p><code>
101       DirectoryIndex index.html index.txt  /cgi-bin/index.pl
102     </code></p></div>
103
104     <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
105     executed if neither <code>index.html</code> or <code>index.txt</code>
106     existed in a directory.</p>
107
108 </div>
109 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
110 <div class="directive-section"><h2><a name="DirectorySlash" id="DirectorySlash">DirectorySlash</a> <a name="directoryslash" id="directoryslash">Directive</a></h2>
111 <table class="directive">
112 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Toggle trailing slash redirects on or off</td></tr>
113 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectorySlash On|Off</code></td></tr>
114 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectorySlash On</code></td></tr>
115 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
116 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
117 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
118 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
119 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.51 and later</td></tr>
120 </table>
121     <p>The <code class="directive">DirectorySlash</code> directive determines, whether
122     <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> should fixup URLs pointing to a directory or
123     not.</p>
124
125     <p>Typically if a user requests a resource without a trailing slash, which
126     points to a directory, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> redirects him to the same
127     resource, but <em>with</em> trailing slash for some good reasons:</p>
128
129     <ul>
130     <li>The user is finally requesting the canonical URL of the resource</li>
131     <li><code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> works correctly. Since it doesn't emit
132     the path in the link, it would point to the wrong path.</li>
133     <li><code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> will be evaluated
134     <em>only</em> for directories requested with trailing slash.</li>
135     <li>Relative URL references inside html pages will work correctly.</li>
136     </ul>
137
138     <p>Well, if you don't want this effect <em>and</em> the reasons above don't
139     apply to you, you can turn off the redirect with:</p>
140
141     <div class="example"><p><code>
142         # see security warning below!<br />
143         &lt;Location /some/path&gt;<br />
144         <span class="indent">
145             DirectorySlash Off<br />
146             SetHandler some-handler<br />
147         </span>
148         &lt;/Location&gt;
149     </code></p></div>
150
151     <div class="warning"><h3>Security Warning</h3>
152     <p>Turning off the trailing slash redirect may result in an information
153     disclosure. Consider a situation where <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> is
154     active (<code>Options +Indexes</code>) and <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> is set to a valid resource (say,
155     <code>index.html</code>) and there's no other special handler defined for
156     that URL. In this case a request with a trailing slash would show the
157     <code>index.html</code> file. <strong>But a request without trailing slash
158     would list the directory contents</strong>.</p>
159     </div>
160
161 </div>
162 </div>
163 <div class="bottomlang">
164 <p><span>Available Languages: </span><a href="../en/mod/mod_dir.html" title="English">&nbsp;en&nbsp;</a> |
165 <a href="../ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
166 <a href="../ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
167 <a href="../tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
168 </div><div id="footer">
169 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
170 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
171 </body></html>