Ok, this is driving me batty. I'm trying to remove any instance of index.html or index.php on any URL, preserving the entire path before the matched string and also preserving any arguments that may be passed after.
The goal here is that whatever index file may be passed on the URL, the default/existing index file for that path will always be used, since the server already searches for various index file extensions automatically. This has the benefit of allowing me to change from html to php for any index file without affecting existing links elsewhere on the web and also cleans up the various base/sub-base URLs in browsers.
The other reason is to overcome a limitation with Google analytics where they only allow a single "default" page, such as "index.html" to be defined, even though my site uses both static and dynamic pages and therefor has both .html and .php scattered around.
Just testing with index.php for a moment, I tried this:
RewriteCond %{THE_REQUEST} /index.php HTTP
RewriteRule (.*)index.php$ /$1 [NC,L]
However it fails, causing nothing on the site to work at all.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator,
[email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Any ideas?