<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />

    <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">
        <div align="CENTER">
      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 

      <h3>Apache HTTP Server Version 1.3</h3>
    </div>


    <h1 align="CENTER">Module mod_dir</h1>

    <p>This module provides for "trailing slash" redirects and
    serving directory index files.</p>

    <p><a href="module-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Base<br />
     <a href="module-dict.html#SourceFile"
    rel="Help"><strong>Source File:</strong></a> mod_dir.c<br />
     <a href="module-dict.html#ModuleIdentifier"
    rel="Help"><strong>Module Identifier:</strong></a>
    dir_module</p>

    <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>

      <li>Otherwise, a listing generated by the server. This is
      provided by <a
      href="mod_autoindex.html"><code>mod_autoindex</code></a>.</li>
    </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>.</p>

    <h2>Directives</h2>

    <ul>
      <li><a href="#directoryindex">DirectoryIndex</a></li>
    </ul>
    <hr />

    <h2><a id="directoryindex"
    name="directoryindex">DirectoryIndex</a> directive</h2>
    <!--%plaintext &lt;?INDEX {\tt DirectoryIndex} directive&gt; -->
    <a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> DirectoryIndex
    <em>local-url</em> [<em>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>

    <p>Example:</p>

    <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;</p>

    <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 />

    <h3 align="CENTER">Apache HTTP Server Version 1.3</h3>
    <a href="./"><img src="../images/index.gif" alt="Index" /></a>
    <a href="../"><img src="../images/home.gif" alt="Home" /></a>

    </p>
  </body>
</html>

