add the following directives to your .htaccess
:
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule (.*)\.php$ /$1 [R=301,L,QSA,NC]
Edit: if you're in Localhost :
RewriteBase /sitename/
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule (.*)\.php$ $1 [R=301,L,QSA,NC]