Server Fault is a question and answer site for system and network administrators. 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 need to make my server list directories with a php script I use and would like to just use 1 file for listing the directories, not millions scattered 1 in each directory. Is it possible to use real file paths for the default document field? It can be used when there are no index files in any certain directory to forward to my php script.

share|improve this question

There is no way to do this by the default IIS, without doing some nasty hacks.

One way to do this is to use URL Re-Writing. You need to leave the Default Document as index.html (or whatever), and using re-writing, re-direct any request to index.html (or any URL with a trailing slash, or whatever) to point to your PHP file.

IIS7 has this functionality built in (I've not used it so I don't know where to find it). For IIS6 and below you will need ISAPI ReWrite to achieve this.

Another way is to change your Document Handler for a 404 (or whatever the appropriate response is when no default document is found) to run your PHP script. This will generate a lot of failures in your log file though.

You can find this property in IIS6 by right-clicking on your website and going to Properties. I don't know where to find it in IIS7 but I'm sure it's around.

share|improve this answer

This is probably a stupid answer but if you want to list directories, can't you just turn on directory browsing or something?

share|improve this answer
The thought crossed my mind too, but I assumed that it must do some pre-processing or formatting or something – Mark Henderson Oct 8 '09 at 20:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.