What happens when a web page request is for a directory?

From Market Ruler Help
Jump to: navigation, search
Internet Information Server Documents properties panel
Adding or removing default content pages when a particular directory is requested

When a Web Browser requests a page which ends with a trailing slash "/", it usually means that it is requesting a Directory on a remote system.

Different Web Servers handle this in slightly different ways.

Apache Web Server

The Apache Web Server has a configuration directive called DirectoryIndex which allows a web site operator to specify a list of files which will be served when a visitor requests a directory.

It would appear in a specific web server's configuration file like:

DirectoryIndex index.htm index.html index.php

Microsoft Internet Information Server

Similarly, the Microsoft Internet Information Server (IIS) has a configuration property panel called Documents and you can specify the list of files, and the order the web server should search for them:

What happens

The web server will search within the requested directory for the available files. For IIS, the search for the files is case-insensitive. That is, "default.htm" or "DeFaUlT.HTM" would be loaded, regardless of the capitalization.

If a file is found, then it is served for that request.

If no file is found, the web server will either server an error page such as 404 Page Not Found, or alternatively, show a directory listing of all of the files in that directory.