mod_dir.xml revision 111436a32ba1254291e4883292fb116d15fe8f64
d24d4c5159bcb11c25bb294926cfe7105c789ea9slive<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding the License. You may obtain a copy of the License at
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd Unless required by applicable law or agreed to in writing, software
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd distributed under the License is distributed on an "AS IS" BASIS,
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd See the License for the specific language governing permissions and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd limitations under the License.
6a7d71eb77725eb1b1091a94289696ab07946c7bslive<description>Provides for "trailing slash" redirects and
d24d4c5159bcb11c25bb294926cfe7105c789ea9slive serving directory index files</description>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>The index of a directory can come from one of two sources:</p>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <li>A file written by the user, typically called
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <code>index.html</code>. The <directive module="mod_dir"
6a7d71eb77725eb1b1091a94289696ab07946c7bslive >DirectoryIndex</directive> directive sets the
6a7d71eb77725eb1b1091a94289696ab07946c7bslive name of this file. This is controlled by
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <li>Otherwise, a listing generated by the server. This is
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>The two functions are separated so that you can completely
6a7d71eb77725eb1b1091a94289696ab07946c7bslive remove (or replace) automatic index generation should you want
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>A "trailing slash" redirect is issued when the server
6a7d71eb77725eb1b1091a94289696ab07946c7bslive receives a request for a URL
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <code>dirname</code> is a directory. Directories require a
6a7d71eb77725eb1b1091a94289696ab07946c7bslive trailing slash, so <module>mod_dir</module> issues a redirect to
6a7d71eb77725eb1b1091a94289696ab07946c7bslive<directivesynopsis>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive<description>List of resources to look for when the client requests
6a7d71eb77725eb1b1091a94289696ab07946c7bslivea directory</description>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive<syntax>DirectoryIndex
b6d2c204c150843e48f6787c1090ae75b718896ecovener disabled | <var>local-url</var> [<var>local-url</var>] ...</syntax>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd<contextlist><context>server config</context><context>virtual host</context>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd<context>directory</context><context>.htaccess</context></contextlist>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>The <directive>DirectoryIndex</directive> directive sets the
6a7d71eb77725eb1b1091a94289696ab07946c7bslive 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
6a7d71eb77725eb1b1091a94289696ab07946c7bslive the server relative to the requested directory; it is usually the
6a7d71eb77725eb1b1091a94289696ab07946c7bslive name of a file in the directory. Several URLs may be given, in
6a7d71eb77725eb1b1091a94289696ab07946c7bslive which case the server will return the first one that it finds. If
6a7d71eb77725eb1b1091a94289696ab07946c7bslive none of the resources exist and the <code>Indexes</code> option is
6a7d71eb77725eb1b1091a94289696ab07946c7bslive set, the server will generate its own listing of the
6a7d71eb77725eb1b1091a94289696ab07946c7bslive directory.</p>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd DirectoryIndex index.html
6a7d71eb77725eb1b1091a94289696ab07946c7bslive </highlight>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>then a request for <code>http://example.com/docs/</code> would
6a7d71eb77725eb1b1091a94289696ab07946c7bslive return <code>http://example.com/docs/index.html</code> if it
6a7d71eb77725eb1b1091a94289696ab07946c7bslive exists, or would list the directory if it did not.</p>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p>Note that the documents do not need to be relative to the
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd directory;</p>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive </highlight>
f5cbf3a7818c08d2f19c04fdf4f47257eea7d3c6nd <p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
63de18ba5e922ffaab500317d7d1d0ad6b27b7e2covener executed if neither <code>index.html</code> or <code>index.txt</code>
b6d2c204c150843e48f6787c1090ae75b718896ecovener existed in a directory.</p>
b6d2c204c150843e48f6787c1090ae75b718896ecovener <p>A single argument of "disabled" prevents <module>mod_dir</module> from
b6d2c204c150843e48f6787c1090ae75b718896ecovener searching for an index. An argument of "disabled" will be interpreted
63de18ba5e922ffaab500317d7d1d0ad6b27b7e2covener literally if it has any arguments before or after it, even if they are "disabled"
6a7d71eb77725eb1b1091a94289696ab07946c7bslive as well.</p>
6a7d71eb77725eb1b1091a94289696ab07946c7bslive <p><strong>Note:</strong> Multiple <directive>DirectoryIndex</directive>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd directives within the <a href="/sections.html"><em>same context</em></a> will add
3b2d0dc9701458b42e573190ffe7344315d7bd31nd to the list of resources to look for rather than replace:
3b2d0dc9701458b42e573190ffe7344315d7bd31nd# Example A: Set index.html as an index page, then add index.php to that list as well.
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<Directory /foo>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd DirectoryIndex index.html
3b2d0dc9701458b42e573190ffe7344315d7bd31nd DirectoryIndex index.php
a7749772d764a29ed2376733f951c4c9a28b2121nd</Directory>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd# Example B: This is identical to example A, except it's done with a single directive.
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<Directory /foo>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd</Directory>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd# Example C: To replace the list, you must explicitly reset it first:
3b2d0dc9701458b42e573190ffe7344315d7bd31nd# In this example, only index.php will remain as an index resource.
90361ddfb3a8abaa0f8fb1729732062c78d8dc50niq<Directory /foo>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd DirectoryIndex index.html
3b2d0dc9701458b42e573190ffe7344315d7bd31nd DirectoryIndex disabled
3b2d0dc9701458b42e573190ffe7344315d7bd31nd DirectoryIndex index.php
3b2d0dc9701458b42e573190ffe7344315d7bd31nd</Directory>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd </highlight>
571d9bf2dccc0cb3d944fd06a96218ab49899513nd</directivesynopsis>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<directivesynopsis>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<description>Configures an external redirect for directory indexes.
3b2d0dc9701458b42e573190ffe7344315d7bd31nd</description>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<syntax>DirectoryIndexRedirect on | off | permanent | temp | seeother |
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<contextlist><context>server config</context><context>virtual host</context>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<context>directory</context><context>.htaccess</context></contextlist>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd<compatibility>Available in version 2.3.14 and later</compatibility>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <p>By default, the <directive>DirectoryIndex</directive> is selected
3b2d0dc9701458b42e573190ffe7344315d7bd31nd and returned transparently to the client. <directive
3b2d0dc9701458b42e573190ffe7344315d7bd31nd >DirectoryIndexRedirect</directive> causes an external redirect
3b2d0dc9701458b42e573190ffe7344315d7bd31nd to instead be issued.</p>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <li><code>on</code> : issues a 302 redirection to the index resource.</li>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <li><code>off</code> : does not issue a redirection. This is the legacy behaviour of mod_dir.</li>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <li><code>permanent</code> : issues a 301 (permanent) redirection to the index resource.</li>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <li><code>temp</code> : this has the same effect as <code>on</code></li>
3b2d0dc9701458b42e573190ffe7344315d7bd31nd <li><code>seeother</code> : issues a 303 redirection (also known as "See Other") to the index resource.</li>
a3de986b8f062c83ceda21a7389787712214b02cniq <li><var>3xx-code</var> : issues a redirection marked by the chosen 3xx code.</li>
a3de986b8f062c83ceda21a7389787712214b02cniq DirectoryIndexRedirect on
a3de986b8f062c83ceda21a7389787712214b02cniq </highlight>
a3de986b8f062c83ceda21a7389787712214b02cniq </example>
a3de986b8f062c83ceda21a7389787712214b02cniq <p>A request for <code>http://example.com/docs/</code> would
a3de986b8f062c83ceda21a7389787712214b02cniq return a temporary redirect to <code
a3de986b8f062c83ceda21a7389787712214b02cniq if it exists.</p>
a3de986b8f062c83ceda21a7389787712214b02cniq</directivesynopsis>
a3de986b8f062c83ceda21a7389787712214b02cniq<directivesynopsis>
7db9f691a00ead175b03335457ca296a33ddf31bnd<description>Toggle trailing slash redirects on or off</description>
FallbackResource /not-404.php
FallbackResource /index.php