RewriteEngine On

# 1. Redirect *.php URLs to extensionless URL
RewriteCond %{THE_REQUEST} \s/([^.]+)\.php[\s?]
RewriteRule ^ %1 [R=301,L]

# 2. Rewrite clean URL → actual .php file internally
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L]

# 3. Hide PHP version
Header unset X-Powered-By
php_flag expose_php Off
