The following code should work for you in the .htaccess file to hide the .php extension:
Options +FollowSymlinks -MultiViews RewriteEngine on # to make `/path/index.php` to /path/ RewriteCond %{THE_REQUEST} ^GET\s(.*/)index\.php [NC] RewriteRule . %1 [NE,R=301,L] RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC] RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^(.*?)/?$ $1.php [L]
Also remember that these rules will have a NO effect in your php, for example: include 'myheader.php';
This is because these included processes are handled by php itself and do not go through Apache.
source share