Reputation: 1829
I have two index files in my public_html folder (Apache), index.html and index.php
By default Apache seems to be directing traffic to index.php, so I want to change that to index.html. I added a .htaccess file in the same directory with this in it:
DirectoryIndex index.html
But when visitors go to the website (www.example.com/), they are still directed to index.php
Why is this?
Upvotes: 14
Views: 33620
Reputation: 899
You have to check if there is any htaccess rule on parent directory that conflics with this rule, my problem was that, having a RewriteEngine on root directory and "/folder/" DirectoryIndex won't work.
Upvotes: 0
Reputation: 913
For those who are still searching for the answer - just like the OP suggests, add the following line to your .htaccess file:
DirectoryIndex index.php
Make sure your hosting is allowing htaccess override in httpd.conf
AllowOverride All
If it's not enabled, you'll have to contact your hosting provider.
Upvotes: 14
Reputation: 151
Silly question, but have you proven that your htaccess file is being utilized?
See: http://httpd.apache.org/docs/current/mod/core.html#allowoverride
Upvotes: 0
Reputation: 7519
Try this:
DirectoryIndex index.html index.htm index.php index.php3
Precedence is from left to right, so if you happen to have both html will be preferred
Upvotes: 4