Apr 9 2008

serve .html then .php

Posted by mark at 1:48 PM
2 comments
- Categories: Apache

Firstly, why?...well, there could be any number of reasons really, I was just developing an application on a server and didn't want its index to be the default public facing file until I'd configured it a bit, I knew that the code I was working on required an index.php file to be uploaded and I also knew (by way of a little test) that apache would serve that first so I got to digging about for the correct apache config option to serve index.html until I was ready for index.php to be default. (incidently, this of course, applies to any file extension you happen to be using, like .cfm for example)

Firstly I headed directly into httpd.conf to locate the DirectoryIndex option and discovered that the order was correct for what i required...ie index.html was to be served before index.php....but I knew that it wasn't so what was going on?...well, in short I don't know...maybe someone can explain it here? The workaround I discovered was to create a .htaccess file for the domain in question and simply add the following:

DirectoryIndex index.html index.php

job done...

Comments

Ryan

Ryan wrote on 04/09/08 9:34 PM

I knew that about a year ago...I'm cooler than you! ;P
Mark

Mark wrote on 04/10/08 10:07 AM

I probably knew it 6 years ago but forgot it so there! my point was that this shouldn't really require a .htaccess to do this, httpd.conf should take care of this but for some reason isn't, and did ask if anyone had an explaination as to why this might not be working....I take it you dont have one then?....hmmm?......hmmm?....

cooler than me?.....yeh whatever ryan haha ;)

Write your comment



(it will not be displayed)