Why does index.html have priority over index.php?
Solution 1:
It really depends on the Server you're using. This is a matter of configuration. It's not that there's any advantage from using html vs php filetype.
You could say that the .html
variation takes precedence due to the fact that it's the most basic web format.
If you're using Apache, just check the default .htaccess
setup:
DirectoryIndex index.html index.shtml index.php index.htm default.html Default.htm default.html Default.html default.shtml Default.shtml page1.html index.pl index.cgi index.php3 index.phtml home.htm home.html home.shtml index.wml
You can edit that and make it fit your needs.
Solution 2:
@kuroir is right, that depends on the web server configuration, in Apache it's the DirectoryIndex
:
DirectoryIndex index.html index.php index.cgi
That will give priority to .html
files over .php
files, and priority to .php
files over .cgi
files.
Solution 3:
I know this is old and has been accepted but I want to add to this in case someone else has this problem.
I came here when looking for a solution to the same problem. Entering the Wordpress "index.php" into the URL got redirected to "index.html". It had nothing to do with the .htaccess. I finally found the solution in their forum. Wordpress modified the program a couple years ago to strip "index.php" from URLs. So then of course it goes to your default (usually index.html).
To make it behave as you expect, you need to revert the change here: changeset 9203. See Forum topic