Page 1 of 1

[SOLVED] Setting index.php as website homepage

Posted: Wed Jan 26, 2005 7:25 pm
by squire
hi,

I have been using PHP now for a few months or so all on my localhost webserver (Apache). I am running PHP version 4.3.9 as well as MySQL.

My problem is that I want to set index.php as my homepage on my website but testing it on my localhost it does not seem to work. How can I set my homepage to index.php rather than index.html or whatever. I know I can do this for ASP but I am unsure regarding PHP.

Any help is greatly appreciated.

Thanks for reading.

Posted: Wed Jan 26, 2005 7:47 pm
by rehfeld
you could put this in a .htaccess file

Code: Select all

DirectoryIndex index.php index.html foo.htm
apache will read from left to right,
if for example, there is not a file named index.php, then it would look for index.html, and if it cant find index.html, then it would try foo.htm etc......

thats assuming your using apache. i dont know how to do it on other webservers

Posted: Wed Jan 26, 2005 8:27 pm
by squire
rehfeld you were spot on. After a bit of Googling regarding the DirectoryIndex I found that I should go to and open:

C:\Program Files\Apache Group\Apache\conf\httpd.conf

once inside the httpd.conf I searched for DirectoryIndex and relpaced:

DirectoryIndex index.html

TO

DirectoryIndex index.php index.html

This worked perfectly. Thank you again. I hope I can help others by stating what I have done. :)