How to load index.html and not index.php

Support for webhosts that use CentOS
edlentz
Posts: 63
Joined: 2013/06/11 20:20:25

How to load index.html and not index.php

Postby edlentz » 2015/05/30 11:57:31

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

aks
Posts: 2498
Joined: 2014/09/20 11:22:14

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

Postby aks » 2015/05/30 16:05:16

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)

edlentz
Posts: 63
Joined: 2013/06/11 20:20:25

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

Postby edlentz » 2015/05/30 16:56:42

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

aks
Posts: 2498
Joined: 2014/09/20 11:22:14

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

Postby aks » 2015/05/31 07:45:14

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.

edlentz
Posts: 63
Joined: 2013/06/11 20:20:25

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

Postby edlentz » 2015/05/31 11:18:28

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.

User avatar
TrevorH
Forum Moderator
Posts: 21161
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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

Postby TrevorH » 2015/05/31 12:38:16

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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

edlentz
Posts: 63
Joined: 2013/06/11 20:20:25

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

Postby edlentz » 2015/05/31 12:55:20

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 !!