| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> |
| <HTML> |
| <HEAD> |
| <TITLE>Apache module mod_dir</TITLE> |
| </HEAD> |
| |
| <!-- Background white, links blue (unvisited), navy (visited), red (active) --> |
| <BODY |
| BGCOLOR="#FFFFFF" |
| TEXT="#000000" |
| LINK="#0000FF" |
| VLINK="#000080" |
| ALINK="#FF0000" |
| > |
| <!--#include virtual="header.html" --> |
| <H1 ALIGN="CENTER">Module mod_dir</H1> |
| |
| This module is contained in the <CODE>mod_dir.c</CODE> file, and |
| is compiled in by default. It provides for "trailing slash" redirects and |
| serving directory index files. |
| |
| <H2>Summary</H2> |
| The index of a directory can come from one of two sources: |
| <UL> |
| <LI>A file written by the user, typically called <CODE>index.html</CODE>. |
| The <A HREF="#directoryindex">DirectoryIndex</A> directive sets |
| the name of this file. |
| This is controlled by <CODE>mod_dir</CODE>. |
| <LI>Otherwise, a listing generated by the server. This is provided by |
| <A HREF="mod_autoindex.html"><CODE>mod_autoindex</CODE></A>. |
| </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> |
| |
| <H2><A NAME="directoryindex">DirectoryIndex</A></H2> |
| <!--%plaintext <?INDEX {\tt DirectoryIndex} directive> --> |
| <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> |
| |