Remove php extension from a specific url
To remove php extension from a url (e.g. /foo/bar.php) the following Apache rewrite rule can be used:
RewriteRule ^/foo/bar /foo/bar.php [L]
Remove php extension from a directory
The following RewriteRule can be used to remove php extension from a directory. We are assuming file name (before .php extension) contains only dash and alphanumeric characters.
RewriteRule ^/foo/([-\w]+) /foo/$1.php [L]