RewriteEngine On

# Enable rewriting
Options +FollowSymLinks

# Remove .php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]

# Prevent direct access to .php files (optional)
# RewriteCond %{THE_REQUEST} \.php[\s?] [NC]
# RewriteRule ^(.*)\.php$ /$1 [R=301,L]