How to make a .php page the default

Started by
5 comments, last by Mulligan 20 years, 6 months ago
I had a .html page called index.html on my site, but now Ive changed it to index.php file and it no longer displays automatically. How do I get it to display automatically like index page?
Advertisement
Do you run the server?


[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people
[size=2]
yea
In your config file locate the "DirectoryIndex" line - add index.php there.

[edit] typo


[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people

[edited by - wild_pointer on October 6, 2003 10:10:00 PM]
[size=2]
I just scanned all the files for the server and none of them contain a line with 'DirectoryIndex' in it, is it somewhere special?

[EDIT]

oh wait, i got something here, 1 sec


[EDIT AGAIN]

Ok i found this line

DirectoryIndex index.html index.html.var

now should I comment it out and make it

DirectoryIndex index.php index.php.var ?

I just tried adding the line (above) and saving it, it didnt work. Then I commented out the origional line and put the php line, but it still didnt work. Hmm.

Thanks for the quicke reponses, you got me on the right track, thanks.

[edited by - Mulligan on October 6, 2003 10:16:58 PM]
If you are using Apache 1 or 2:
go the root dir where you installed it
go to the conf/ dir
open httpd.conf
on about line 326, you will have somthing like this:
## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.## The index.html.var file (a type-map) is used to deliver content-# negotiated documents.  The MultiViews Option can be used for the# same purpose, but it is much slower.#DirectoryIndex index.html index.html.var  

add index.php to the end of that string:
#DirectoryIndex index.html index.html.var index.php  

restart Apache



edit: yours might look a litle diferent, but the directive (DirectoryIndex) is the same.

[edited by - aftermath on October 6, 2003 10:17:35 PM]
Rate me up.
Yay! Thanks! I don''t know what i would do without gamedev.... maybe be a lot more frustrated, thanks guys!

This topic is closed to new replies.

Advertisement