You can use the following :
#remove the .php extention for root dir only
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*?)/?$ $1.php
0 Comments