Web Hosting Talk







View Full Version : Changing default files on Apache?


Noonard
01-23-2002, 01:29 PM
Ok, I'm sure this one's really basic but I've not had to do it before so bear with me... :eek:

On an Apache server, how can I set it so that the default file is something OTHER than default.html or index.html? I want to set the default file as a PHP script. Is this a setting in .htaccess?

Hope someone can help (and most likely call me a fool :D )

Thanks!

Smirks
01-23-2002, 02:02 PM
You can use your .htaccess file, put this in it..

DirectoryIndex index.php

change index.php to whatever you want the first page to be. :)

Noonard
01-23-2002, 02:35 PM
I knew it was gonna be something easy!

Thanks for your help!


Cheers! :beer:

serve-you
01-23-2002, 05:34 PM
If you want these files to be accessable serverwide, you should add them to your httpd.conf. The Directive is "DirectoryIndex" You can add anything you want thereso that these files will always be used as he default index.

-Dan

allan
01-23-2002, 06:50 PM
Originally posted by serve-you
If you want these files to be accessable serverwide, you should add them to your httpd.conf. The Directive is "DirectoryIndex" You can add anything you want thereso that these files will always be used as he default index.


Note that when doing this, or when using the .htaccess method, order counts. If you use a line like:

DirectoryIndex index.html index.htm index.php

Then Apache is going to look for index.html first, if it does not find index.html it will look for index.htm then index.php. So, if you have index.html and index.php in a directory -- and the files are in the order listed above -- Apache won't process index.php

Noonard
01-23-2002, 07:08 PM
cunning indeed!

i really should spend some time playing around with my apache setup to find out what it can do... (yeah right, like i've got time for that!)

thanks for the advice guys!