Yes, I\'ve read the Apache manual and searched here. For some reason I simply cannot get this to work. The closest I\'ve come is having it remove the extension, but it point
In addition to other answers above,
You may also try this to remove .php extensions completly from your file and to avoid infinite loop :
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [NC,L]
This code will work in Root/.htaccess, Be sure to change the RewriteBase if you want to place this to a htaccess file in sub directory.
Edit :
On apache 2.4 and later, you can also use the END flag to prevent infinite loop error. The following example works same as the above on apache 2.4 ,
RewriteEngine on
RewriteRule ^(.+)\.php$ /$1 [R,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,END]