mod_dir.html.en revision 63de18ba5e922ffaab500317d7d1d0ad6b27b7e2
97a9a944b5887e91042b019776c41d5dd74557aferikabele<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
97a9a944b5887e91042b019776c41d5dd74557aferikabele<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive This file is generated from xml source: DO NOT EDIT
a945f35eff8b6a88009ce73de6d4c862ce58de3cslive XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
b686b6a420bde7f78c416b90be11db94cb789979nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
b686b6a420bde7f78c416b90be11db94cb789979nd<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>
52fff662005b1866a3ff09bb6c902800c5cc6dedjerenkrantz<p class="apache">Apache HTTP Server Version 2.3</p>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
4b5981e276e93df97c34e4da05ca5cf8bbd937dand<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.3</a> > <a href="./">Modules</a></div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/mod/mod_dir.html" title="English"> en </a> |
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<a href="/ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
b686b6a420bde7f78c416b90be11db94cb789979nd<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for "trailing slash" redirects and
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>dir_module</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_dir.c</td></tr></table>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>The index of a directory can come from one of two sources:</p>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <li>A file written by the user, typically called
97a9a944b5887e91042b019776c41d5dd74557aferikabele <code>index.html</code>. The <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> directive sets the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive name of this file. This is controlled by
97a9a944b5887e91042b019776c41d5dd74557aferikabele <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code>.</li>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <li>Otherwise, a listing generated by the server. This is
97a9a944b5887e91042b019776c41d5dd74557aferikabele provided by <code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code>.</li>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>The two functions are separated so that you can completely
06ba4a61654b3763ad65f52283832ebf058fdf1cslive remove (or replace) automatic index generation should you want
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>A "trailing slash" redirect is issued when the server
06ba4a61654b3763ad65f52283832ebf058fdf1cslive receives a request for a URL
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <code>dirname</code> is a directory. Directories require a
97a9a944b5887e91042b019776c41d5dd74557aferikabele trailing slash, so <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> issues a redirect to
b686b6a420bde7f78c416b90be11db94cb789979nd<div id="quickview"><h3 class="directives">Directives</h3>
b686b6a420bde7f78c416b90be11db94cb789979nd<li><img alt="" src="/images/down.gif" /> <a href="#directoryindex">DirectoryIndex</a></li>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<li><img alt="" src="/images/down.gif" /> <a href="#directoryslash">DirectorySlash</a></li>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
b686b6a420bde7f78c416b90be11db94cb789979nd<div class="directive-section"><h2><a name="DirectoryIndex" id="DirectoryIndex">DirectoryIndex</a> <a name="directoryindex" id="directoryindex">Directive</a></h2>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>List of resources to look for when the client requests
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectoryIndex
63de18ba5e922ffaab500317d7d1d0ad6b27b7e2covener None | <var>local-url</var> [<var>local-url</var>] ...</code></td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectoryIndex index.html</code></td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
b686b6a420bde7f78c416b90be11db94cb789979nd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>The <code class="directive">DirectoryIndex</code> directive sets the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive list of resources to look for, when the client requests an index
1887c0b8ceab2c8d64a1e5b3aa512e77b86b49fayoshiki of the directory by specifying a / at the end of the directory
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd name. <var>Local-url</var> is the (%-encoded) URL of a document on
06ba4a61654b3763ad65f52283832ebf058fdf1cslive the server relative to the requested directory; it is usually the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive name of a file in the directory. Several URLs may be given, in
06ba4a61654b3763ad65f52283832ebf058fdf1cslive which case the server will return the first one that it finds. If
06ba4a61654b3763ad65f52283832ebf058fdf1cslive none of the resources exist and the <code>Indexes</code> option is
06ba4a61654b3763ad65f52283832ebf058fdf1cslive set, the server will generate its own listing of the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive directory.</p>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd DirectoryIndex index.html
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>then a request for <code>http://myserver/docs/</code> would
06ba4a61654b3763ad65f52283832ebf058fdf1cslive return <code>http://myserver/docs/index.html</code> if it
06ba4a61654b3763ad65f52283832ebf058fdf1cslive exists, or would list the directory if it did not.</p>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>Note that the documents do not need to be relative to the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive directory;</p>
06ba4a61654b3763ad65f52283832ebf058fdf1cslive <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd executed if neither <code>index.html</code> or <code>index.txt</code>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd existed in a directory.</p>
63de18ba5e922ffaab500317d7d1d0ad6b27b7e2covener <p>A value of "None" prevents <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> from
63de18ba5e922ffaab500317d7d1d0ad6b27b7e2covener searching for an index.</p>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<div class="directive-section"><h2><a name="DirectorySlash" id="DirectorySlash">DirectorySlash</a> <a name="directoryslash" id="directoryslash">Directive</a></h2>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Toggle trailing slash redirects on or off</td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DirectorySlash On|Off</code></td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>DirectorySlash On</code></td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Indexes</td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_dir</td></tr>
94aca1822ea6eaaecfa4ee8fb58b7c3264efd944nd<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.51 and later</td></tr>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <p>The <code class="directive">DirectorySlash</code> directive determines, whether
4cc6016bd30b0852222630a0ed62805e36f345d1nd <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> should fixup URLs pointing to a directory or
4cc6016bd30b0852222630a0ed62805e36f345d1nd <p>Typically if a user requests a resource without a trailing slash, which
4cc6016bd30b0852222630a0ed62805e36f345d1nd points to a directory, <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> redirects him to the same
90361ddfb3a8abaa0f8fb1729732062c78d8dc50niq resource, but <em>with</em> trailing slash for some good reasons:</p>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <li>The user is finally requesting the canonical URL of the resource</li>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <li><code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code> works correctly. Since it doesn't emit
4cc6016bd30b0852222630a0ed62805e36f345d1nd the path in the link, it would point to the wrong path.</li>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <li><code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> will be evaluated
4cc6016bd30b0852222630a0ed62805e36f345d1nd <em>only</em> for directories requested with trailing slash.</li>
95d05f094d56c5986659f1aa7e57f258850b1287nd <li>Relative URL references inside html pages will work correctly.</li>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <p>Well, if you don't want this effect <em>and</em> the reasons above don't
4cc6016bd30b0852222630a0ed62805e36f345d1nd apply to you, you can turn off the redirect with:</p>
4cc6016bd30b0852222630a0ed62805e36f345d1nd # see security warning below!<br />
4cc6016bd30b0852222630a0ed62805e36f345d1nd DirectorySlash Off<br />
4cc6016bd30b0852222630a0ed62805e36f345d1nd SetHandler some-handler<br />
4cc6016bd30b0852222630a0ed62805e36f345d1nd </Location>
4cc6016bd30b0852222630a0ed62805e36f345d1nd <p>Turning off the trailing slash redirect may result in an information
4cc6016bd30b0852222630a0ed62805e36f345d1nd disclosure. Consider a situation where <code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code> is
4cc6016bd30b0852222630a0ed62805e36f345d1nd active (<code>Options +Indexes</code>) and <code class="directive"><a href="#directoryindex">DirectoryIndex</a></code> is set to a valid resource (say,
4cc6016bd30b0852222630a0ed62805e36f345d1nd <code>index.html</code>) and there's no other special handler defined for
4cc6016bd30b0852222630a0ed62805e36f345d1nd that URL. In this case a request with a trailing slash would show the
4cc6016bd30b0852222630a0ed62805e36f345d1nd <code>index.html</code> file. <strong>But a request without trailing slash
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/mod/mod_dir.html" title="English"> en </a> |
7f5b59ccc63c0c0e3e678a168f09ee6a2f51f9d0nd<a href="/ja/mod/mod_dir.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/ko/mod/mod_dir.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
1ac39787115a288f5e848344b1b1e8dccb1c58f1nd<a href="/tr/mod/mod_dir.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
eac602f079a7b6a1039df751710a2c734c5f67cenoirin<p class="apache">Copyright 2008 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>
b686b6a420bde7f78c416b90be11db94cb789979nd<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>