About web page directory indexing

Directory indexing is when a directory listing of files is displayed in a browser instead of an actual web page. This occurs when a URL resolves to a directory that does not contain a default file. The Sitehost server at Indiana University looks for the following default files in the order listed below:

Note:
If your directory contains more than one of the following files, the web server will display the first one from the lists below.
  • index.php
  • index.html
  • home.html

Pages looks for the following:

  • home.html
  • index.html

By default, directory indexing on Sitehost and Pages is disabled. This means that your website needs to have the directory indexing manually enabled as mentioned below, or an index file (see above filenames) needs to be located in the web directory. If directory indexing is not enabled, and there is no index file available, your website will display a 403 "Forbidden" error. The University Information Security Office considers this a prudent action to remove the possibility of unauthorized users discovering information about the file system that isn't specifically needed. Individual account owners must therefore assess whether this feature is appropriate for their web accounts.

Enable directory indexing

To enable directory indexing in your account, you need to create a file and save it as .htaccess. You can have additional information in this file, but to enable indexing you must have the following line:

 Options Indexes

If the directory or subdirectory for which you wish to enable indexing contains files that use server-side includes (for example, CGI, symlinks), you will need to add the following to the .htaccess file:

ExecCGI For CGI files
IncludesNOEXEC For server-side includes
SymLinksIfOwnerMatch For symlinks

For example, if you wish to enable directory indexing, and the directory or subdirectories therein contain cgi files and files using server-side includes, you would place the following line in your .htaccess file:

 Options Indexes ExecCGI IncludesNOEXEC

Place the .htaccess file in the directory for which you would like to have directory indexing enabled. It is recursive, so any subdirectories therein will be enabled as well. For more about .htaccess files, see Control web page access for Pages.

This is document amej in the Knowledge Base.
Last modified on 2021-09-08 10:17:38.