Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Document

Status
Not open for further replies.

y2k1981

Programmer
Aug 2, 2002
773
IE
I've just installed apache on my NT 4 workstation for home use only as I'm trying out some server side scripting and ofcourse need to have a HTTP server to do this. My question is, how do I set the default document? I copied an index.html file into the htdocs folder, which is the root folder (don't know if root is the right work to describe it) as I found out in the configuration file (I can't remember what the name of that is right now) but how do I set what the default document is. Why I typed in - the index.html file displayed so obviously that's the default document, but suppose I wanted to change it to index.php, how would I go about it? Also, I assumed if index.html was the default document, it was the default document for all folders. I created a contact folder and typed (after I copied index.html there also) but id didn't display so obviously I have to set the default document for EVERY folder I create???
 
You use the DirectoryIndex directive in your httpd.conf.
To put multiple files in there, do this:
Code:
DirectoryIndex index.html index.htm index.shtml index.php
etc. //Daniel
 
let me guess, it'll look for index.html and if it doesn't exist it'll look for index.htm, and keep going until it gets to the end, right?

Does it matter what part of the file I enter this in? And will it affect all folders?

Thanks!!
 
Yes, that's how it works.
It is most likely already in your httpd.conf, search for it and replace/append to the existing line. //Daniel
 
It will affect all folders, and also you must restart Apache anytime you change the httpd.conf for it to take effect. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
You may have figured it out already but it will search in the order you have them in the list.
 
Hi again,

The above is working fine for the root folder, but if I specify a folder further down the hierarchy eg - it doesn't find the index.html file. Why is that? It's just gives the 404 error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top