6.2. Using default documents

Loading the module. We will add lines to the configuration file to load the module and to set up a default file. Because we want this functionality for both websites we place the instruction outside and before the virtual host sections.


LoadModule	dir_module	/usr/lib/apache2/mod_dir.so
DirectoryIndex	index.html index.htm

Note that we have a new command DirectoryIndex which is the only additional command provided by dir_module. It is passed a list of the defaults to use if the directory is looked for. If a directory is requested then the web server will look for index.html in the directory because that filename is the first argument to the command. If index.html is missing then the server will look for index.htm, the second quoted name. If neither is present then the web server will give a not found error.

Remember the server must reload its configuration to pick up these new instructions.

Syntax summary: dir_module

DirectoryIndex

Specify the documents to be searched for given a directory query.

Document names are resolved relative to the directory queried unless they start with a / when they are resolved relative to the document root.