Page 1 of 1

How to load index.html and not index.php

Posted: 2015/05/30 11:57:31
by edlentz
Hi,

I have a page I want to load INSTEAD of index.php. I for the moment called it index.html.. How can I set Apache to load the html instead of the php. I cannot rename the php file. I can rename the html file.

Thanks for any guidance

Re: How to load index.html and not index.php

Posted: 2015/05/30 16:05:16
by aks
Can use just use the DirectoryIndex directive?
1) Make sure directory module is loaded by httpd (I think it's called mod_dir).
2) Then list the preferences in the DirectoryIndex as in DirectoryIndex index.html index.php index.phtml index.htm
Look here for more info (http://httpd.apache.org/docs/2.2/mod/mod_dir.html)

Re: How to load index.html and not index.php

Posted: 2015/05/30 16:56:42
by edlentz
Hi
Thanks for the reply. I found the Directoryindex info after I posted. index.html is in there as the first entry. mod_dir is loaded according to the httpd.conf file Any other ideas??

Thanks

Re: How to load index.html and not index.php

Posted: 2015/05/31 07:45:14
by aks
So you've loaded the module and created the directive - but you can not get the result?
Perhaps post the contents of the file that has the directive.

Re: How to load index.html and not index.php

Posted: 2015/05/31 11:18:28
by edlentz
Here is the entry for DirectoryIndex

Code: Select all

#
# 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
DirectoryIndex index.html 
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
Here is where the module is loaded

Code: Select all

LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
When I restart httpd I do not get any errors.

Re: How to load index.html and not index.php

Posted: 2015/05/31 12:38:16
by TrevorH
I'd suspect that you have more than one DirectoryIndex present in your config files. Run grep -ir directoryindex /etc/httpd/* to find them all.

Re: How to load index.html and not index.php

Posted: 2015/05/31 12:55:20
by edlentz
Nailed it!

There was a php.conf file in /etc/httpd/conf.d that had the directiveindex for index.php After I added index.html before it appears to work the way I want it.

Thanks !!