Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Apache on a Windows machine for local testing and I'm new to it.

Currently, if I navigate to localhost/ in a web browser, it will display an index.html page if one exists. Otherwise, it will display the directory listing.

  • How can I make it so that navigating to a root directory will display more than index.html? What I need is so that if either: index.html, index.htm, or index.php exist, it will navigate to one of those.
  • How can I disable showing directory roots? I would like it to return a 403 Forbidden error if no index page exists.
share|improve this question

First for the index part. Open up your httpd.conf file and look for this section.

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents.  The MultiViews Option can be used for the
# same purpose, but it is much slower.
#        
DirectoryIndex index.htm index.html index.html.var

In most cases you won't add index.php here since it will either be in a separate conf or in the php.conf.

Then for your directory listing there are a few options. You can either use a .htaccess file or put it in the httpd conf. For the conf file you can add something like this.

<Directory /path/to/directory>
   Options -Indexes
</Directory> 
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .