DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 12.7 Alternate Default Document

Problem

You want to have some file other than index.html appear by default.

Solution

Use DirectoryIndex to specify the new name:

DirectoryIndex default.htm

Discussion

When a directory is requested—that is, a URL ending in a / rather than in a file name—mod_dir will select the index document from that directory and serve that file in response. By default, the index file is assumed to be index.html, but this can be configured to something else with the DirectoryIndex directive.

Note also that DirectoryIndex can be set to several files, which are listed in order of precedence:

DirectoryIndex index.html index.htm index.php default.htm

Finally, note that you can also provide a relative URL if you want to load content from some other directory, such as a CGI program:

DirectoryIndex /cgi-bin/index.pl

See Also

    [ Team LiB ] Previous Section Next Section