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
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>
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.2</p>
17
<img alt="" src="../images/feather.gif" /></div>
18
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
21
<div id="page-content">
22
<div id="preamble"><h1>Apache Module mod_dir</h1>
24
<p><span>Available Languages: </span><a href="../en/mod/mod_dir.html" title="English"> en </a> |
25
<a href="../ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
26
<a href="../ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
28
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for "trailing slash" redirects and
29
serving directory index files</td></tr>
30
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
31
<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>dir_module</td></tr>
32
<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_dir.c</td></tr></table>
35
<p>The index of a directory can come from one of two sources:</p>
38
<li>A file written by the user, typically called
39
<code>index.html</code>. The <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> directive sets the
40
name of this file. This is controlled by
41
<code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code>.</li>
43
<li>Otherwise, a listing generated by the server. This is
44
provided by <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code>.</li>
46
<p>The two functions are separated so that you can completely
47
remove (or replace) automatic index generation should you want
50
<p>A "trailing slash" redirect is issued when the server
51
receives a request for a URL
52
<code>http://servername/foo/dirname</code> where
53
<code>dirname</code> is a directory. Directories require a
54
trailing slash, so <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> issues a redirect to
55
<code>http://servername/foo/dirname/</code>.</p>
57
<div id="quickview"><h3 class="directives">Directives</h3>
59
<li><img alt="" src="../images/down.gif" /> <a href="#directoryindex">DirectoryIndex</a></li>
60
<li><img alt="" src="../images/down.gif" /> <a href="#directoryslash">DirectorySlash</a></li>
64
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
65
<div class="directive-section"><h2><a name="DirectoryIndex" id="DirectoryIndex">DirectoryIndex</a> <a name="directoryindex" id="directoryindex">Directive</a></h2>
66
<table class="directive">
67
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>List of resources to look for when the client requests
69
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectoryIndex
70
<var>local-url</var> [<var>local-url</var>] ...</code></td></tr>
71
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectoryIndex index.html</code></td></tr>
72
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
73
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
74
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
75
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
77
<p>The <code class="directive">DirectoryIndex</code> directive sets the
78
list of resources to look for, when the client requests an index
79
of the directory by specifying a / at the end of the directory
80
name. <var>Local-url</var> is the (%-encoded) URL of a document on
81
the server relative to the requested directory; it is usually the
82
name of a file in the directory. Several URLs may be given, in
83
which case the server will return the first one that it finds. If
84
none of the resources exist and the <code>Indexes</code> option is
85
set, the server will generate its own listing of the
88
<div class="example"><h3>Example</h3><p><code>
89
DirectoryIndex index.html
92
<p>then a request for <code>http://myserver/docs/</code> would
93
return <code>http://myserver/docs/index.html</code> if it
94
exists, or would list the directory if it did not.</p>
96
<p>Note that the documents do not need to be relative to the
99
<div class="example"><p><code>
100
DirectoryIndex index.html index.txt /cgi-bin/index.pl
103
<p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
104
executed if neither <code>index.html</code> or <code>index.txt</code>
105
existed in a directory.</p>
108
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
109
<div class="directive-section"><h2><a name="DirectorySlash" id="DirectorySlash">DirectorySlash</a> <a name="directoryslash" id="directoryslash">Directive</a></h2>
110
<table class="directive">
111
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Toggle trailing slash redirects on or off</td></tr>
112
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectorySlash On|Off</code></td></tr>
113
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectorySlash On</code></td></tr>
114
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
115
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
116
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
117
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
118
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.51 and later</td></tr>
120
<p>The <code class="directive">DirectorySlash</code> directive determines, whether
121
<code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> should fixup URLs pointing to a directory or
124
<p>Typically if a user requests a resource without a trailing slash, which
125
points to a directory, <code class="module"><a href="../mod/mod_dir.html">mod_dir</a></code> redirects him to the same
126
resource, but <em>with</em> trailing slash for some good reasons:</p>
129
<li>The user is finally requesting the canonical URL of the resource</li>
130
<li><code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> works correctly. Since it doesn't emit
131
the path in the link, it would point to the wrong path.</li>
132
<li><code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> will be evaluated
133
<em>only</em> for directories requested with trailing slash.</li>
134
<li>Relative URL references inside html pages will work correctly.</li>
137
<p>Well, if you don't want this effect <em>and</em> the reasons above don't
138
apply to you, you can turn off the redirect with:</p>
140
<div class="example"><p><code>
141
# see security warning below!<br />
142
<Location /some/path><br />
143
<span class="indent">
144
DirectorySlash Off<br />
145
SetHandler some-handler<br />
150
<div class="warning"><h3>Security Warning</h3>
151
<p>Turning off the trailing slash redirect may result in an information
152
disclosure. Consider a situation where <code class="module"><a href="../mod/mod_autoindex.html">mod_autoindex</a></code> is
153
active (<code>Options +Indexes</code>) and <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> is set to a valid resource (say,
154
<code>index.html</code>) and there's no other special handler defined for
155
that URL. In this case a request with a trailing slash would show the
156
<code>index.html</code> file. <strong>But a request without trailing slash
157
would list the directory contents</strong>.</p>
162
<div class="bottomlang">
163
<p><span>Available Languages: </span><a href="../en/mod/mod_dir.html" title="English"> en </a> |
164
<a href="../ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
165
<a href="../ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
166
</div><div id="footer">
167
<p class="apache">Copyright 2006 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>
168
<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>
b'\\ No newline at end of file'