Greg's Blog

helping me remember what I figure out

Apache: Setting the Default Document

| Comments

Here’s how to set your default web documents that the web server will load should you not specify a specific file (e.g. default.html or index.html). By default Apache sets index.html as your default document, but since I used Cold Fusion as well I wanted Apache to automatically load up index.cfm as well when a directory was called. TO his end locate your conf directory, usually found under c:program filesApache GroupApacheconf and look for the file httpd.conf. About halfway down you should see a set of lines similar to this:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
DirectoryIndex index.html

Now simply append index.cfm, making sure that there is a space between the two file names. This should look as such now:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
DirectoryIndex index.html index.cfm

All you need to do now is stop and restart your web server for the changes to take effect. There you go the server will now first look for index.html and then index.cfm. Your web server should now be less likely to show a directory listing!