My .htaccess
file contains the following directives
DirectoryIndex index.html index.php
# redirect invalid requests and missing files to the home page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://www.mydomain.com/ [L]
The problem is that many programmers(loosely used term) worked on this site. Some directories use index.html
and some use index.php
.
If a directory uses index.php
, the request to www.mydomain.com/directory
looks for www.mydomain.com/directory/index.html
and is redirected to www.mydomain.com
before it can look for www.mydomain.com/directory/index.php
How can I both try all DirectoryIndex
files AND redirect missing files to the home page?