Apache configuration directive that tells what is the "index" document of the directory - in other words, what will be shown when the directory is requested with no file name given (in other words, the URL ends with a slash).

For example, in case of www.everything2.com server, the DirectoryIndex under DocumentRoot directory probably is something like

DirectoryIndex index.pl

So if you ask "http://www.everything2.com/" or "http://www.everything2.com/index.pl", you'll get the same page.

Multiple documents can be specified, even relative paths can be used. These are tried in order to find the page (so, you can say something like "DirectoryIndex index.shtml index.pl index.jsp index.phtml index.php3 index.html" in your top-level configuration file for reasonable defaults).

And then some subjective-but-proven-practical rambling...

When making a website, PLEASE don't refer to DirectoryIndex documents themselves. You're making yourself a favor if you don't link to "../index.html", just plain "../". Here's a neat thing many HTML-newbies haven't noticed: To link to "index.html", link to "./".

The reason is simple: Websites change, but DocumentRoot is whatever you want it to be. Suppose you have a directory http://www.example.com/dir/, and you have a static index page http://www.example.com/dir/index.html. Now, if you advertise the directory as such, you'll run into trouble when you upgrade your precious 386DX server to Pentium III and change the index page to SSI-parsed page, http://www.example.com/dir/index.shtml, while you're at it. All bookmarks around the world point at index.html, so you'd need to set up redirections and such.

So, to save space and aches, link to directories.

"Ah," now you say, "but when I preview my pages on the home machine, when I click on directory links all I get is file listing!" Well, this minor annoyance is easily fixed by installing a web server on your own machine for preview purposes...

Log in or register to write something here or to contact authors.