Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
Is your Web Server Serving the Correct Index Files?
If your document root is correct and your index pages are not being served correctly when you go to your site or a directory location on your site, you may have your indexes configured incorrectly.
When a visitor requests a directory, typically your server will want to give them an index file. This is usually an index.html file or an index.php file depending on your configuration.
In Apache, you may find a line in your virtual host file that configures the index order that will be used for specific directories explicitly, like this:
¬†¬†¬†¬†DirectoryIndex index.html index.php
This means that when the directory is being served, Apache will look for a file called index.html first, and try to serve index.php as a backup if the first file is not found.
You can set the order that will be used to serve index files for the entire server by editing the mods-enabled/dir.conf file, which will set the defaults for the server. If your server is not serving an index file, make sure you have an index file in your directory that matches one of the options in your file.
In Nginx, the directive that does this is is called index and it is used like this:
¬†¬†¬†¬†listen 80 default_server;
¬†¬†¬†¬†listen [::]:80 default_server ipv6only=on;
¬†¬†¬†¬†index index.html index.htm;
¬†¬†¬†¬†server_name example.com www.example.com;
Jun 9, 2015
to add a comment.
Related Hot Questions
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please