I'm attempting to redirect any requests for a PHP file to the site root, is there any way to do this? We performed a large site upgrade but we want to prevent errors caused by people being referred from old links from Google.
I had attempted to use the following, but it's causing a few issues with our system.
RewriteEngine On RewriteBase / RewriteRule ^(.*)\.php /
We've tried numerous similar ideas, has anyone got a better one (that works)? :D
Update: I forgot to mention that the system we use uses mod_rewrite to direct SEO-friendly URLs to pages. Theoretically there are no direct .php file references in a correct URL. The problem with the above solution is that it seems to bugger up a couple of our scripts, though I have no idea why.