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 Webserve 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
  • index.htm
  • home.htm
  • index.shtml
  • index.cgi
  • index.php3
  • index.php4
  • index.phtml
  • index.xml

Mercury, which serves Pages web pages at IU, looks for the following:

  • home.html
  • index.html
  • home.htm
  • index.htm
  • home.shtml
  • index.shtml
  • index.cgi

At IU, directory indexing has been disabled on Webserve and Mercury. If you do not have a default file in your www directory with one of the names listed above, visitors to your web page will receive a "403" or "Forbidden" error message.

By default, directory indexing on the web is disabled. 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 (e.g., 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 Controlling web page access.

This is document amej in the Knowledge Base.
Last modified on 2018-07-18 08:58:41.

Contact us

For help or to comment, email the UITS Support Center.