You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Robinson <dr...@ast.cam.ac.uk> on 1995/07/25 16:46:00 UTC

DirectoryIndex documentation

The documentation for DirectoryIndex is a bit misleading, as it seems to
allow URL paths to anywhere on the server. It also seems possible to
hang apache, both with an infinite loop like
DirectoryIndex /
but more strangely, with
DirectoryIndex /~drtr/zzz.html

A revised entry for srm.conf.html follows; could someone upload it to
hyperreal? (The transatlantic link is half down at the moment.)

 David.

<H1><A name="index">DirectoryIndex</A></H1>

<P>(n.b. this extends the NCSA httpd 1.3 syntax to a relative URL rather than
a filename, and allow multiple URLs )

<p>Syntax:
<blockquote><code>DirectoryIndex</code> <em>Local-URL Local-URL ...</em>
</blockquote>

<P>This specifies what document the server returns when the user specifies
a NULL file at the end of a directory name. The <em>Local-URL</em> a a URL
of a document on the server relative to the requested directory;
it is usually simply the name of a file in the directory. For example  Most
people use a file called <code>index.html</code>; so
<blockquote><code>DirectoryIndex index.html</code></blockquote>
means that a request for
<blockquote><code>http://www.foo.bar.com/docs/</code></blockquote>
would actually return the document
<blockquote><code>http://www.foo.bar.com/docs/index.html</code></blockquote>

<P>Apache allows you to define any number of these documents,
and Apache will search for each in turn, until it finds a match or it
has exauhsted all the documents. e.g.

<blockquote><code>DirectoryIndex index.html index.txt /cgi-bin/%7Eindex.pl</code>
</blockquote>

<P>Typically, you'll set <CODE>DirectoryIndex</CODE> to
<CODE>index.html</CODE>.  You may want to set it to <CODE>index</CODE>,
thus allowing <a href="content-negotiation.html">content-negotiation</a> to
work for an HTML 2.0 document named "index.html" and an HTML 3.0 document named
"index.html3".