mod_dir.html revision 25503838e438bb909e3ff880125732c7ed5e64ad
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<HTML>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<HEAD>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<TITLE>Apache module mod_dir</TITLE>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw</HEAD>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<BODY
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw BGCOLOR="#FFFFFF"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw TEXT="#000000"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw LINK="#0000FF"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw VLINK="#000080"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw ALINK="#FF0000"
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<!--#include virtual="header.html" -->
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<H1 ALIGN="CENTER">Module mod_dir</H1>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwThis module is contained in the <CODE>mod_dir.c</CODE> file, and
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwis compiled in by default. It provides for "trailing slash" redirects and
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwserving directory index files.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<H2>Summary</H2>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwThe index of a directory can come from one of two sources:
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<UL>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<LI>A file written by the user, typically called <CODE>index.html</CODE>.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwThe <A HREF="#directoryindex">DirectoryIndex</A> directive sets
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwthe name of this file.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwThis is controlled by <CODE>mod_dir</CODE>.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<LI>Otherwise, a listing generated by the server. This is provided by
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw<A HREF="mod_autoindex.html"><CODE>mod_autoindex</CODE></A>.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw</UL>
The two functions are separated so that you can completely remove
(or replace) automatic index generation should you want to.
<P>A "trailing slash" redirect is issued when the server receives a
request for a URL <SAMP>http://servername/foo/dirname</SAMP> where
<SAMP>dirname</SAMP> is a directory. Directories require a trailing
slash, so <CODE>mod_dir</CODE> issues a redirect to
<SAMP>http://servername/foo/dirname/</SAMP>.
<H2>Directives</H2>
<MENU>
<LI><A HREF="#directoryindex">DirectoryIndex</A>
</MENU>
<HR>
<A name="directoryindex"><H2>DirectoryIndex</H2></A>
<!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> DirectoryIndex <EM>local-url local-url ...</EM><BR>
<A
HREF="directive-dict.html#Default"
REL="Help"
><STRONG>Default:</STRONG></A> <CODE>DirectoryIndex index.html</CODE><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
<A
HREF="directive-dict.html#Override"
REL="Help"
><STRONG>Override:</STRONG></A> Indexes<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> mod_dir<P>
The DirectoryIndex 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 a directory name. <EM>Local-url</EM> 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:
<BLOCKQUOTE><CODE>
DirectoryIndex index.html
</CODE></BLOCKQUOTE>
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>
Note that the documents do not need to be relative to the directory;
<BLOCKQUOTE><CODE>
DirectoryIndex index.html index.txt /cgi-bin/index.pl</CODE></BLOCKQUOTE>
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><HR>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>