13.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 filename—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 also can provide a relative URL if you want to load content from some other directory, such as a CGI program:
DirectoryIndex /cgi-bin/index.pl
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access