2.3.43 DirectoryIndex
DirectoryIndex specifies the file containing the content that is to be sent to the client by default, when the request from the web browser does not specify specific content.
Description
DirectoryIndex specifies the name of the file containing the content that is to be sent to the client by default, when the request from the web browser does not specify specific content. If multiple file names are specified, the file name that was specified first takes priority and is sent to the client.
If the file specified for this item does not exist in the requested directory, the display of the web browser changes according to the specification of the Options directive.
- When Indexes is enabled:
-
Displays the directory index created on the web server, in the web browser.
- When Indexes is disabled:
-
Responds by displaying the status code 403 Forbidden.
Syntax
DirectoryIndex file_name [file_name ...]
Locations where it can be written
httpsd.conf, <VirtualHost>, <Directory>, and .htaccess
Overwrite permission
Indexes level
Example
DirectoryIndex index.html
In this case, as long as the directory contains index.html, the directory index is displayed even if the request does not specify the file name.