htaccess redirect any urls ending in .php to index

Posted by Freddie on Stack Overflow See other posts from Stack Overflow or by Freddie
Published on 2011-01-06T20:51:45Z Indexed on 2011/01/06 20:54 UTC
Read the original article Hit count: 245

Filed under:
|
|
|

I've set up my .htaccess so far as follows:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [QSA]

My index.php loads the file from /pages, eg. index.php?page=home will load the page content from pages/home.php

However - if someone went to pages/home.php the page loads without the headers etc. which is undesirable. What can I add to redirect any URLs ending in .php to just take the user to the homepage?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about .htaccess