RewriteEngine On # Redirect clean URLs to .php files (e.g., /about -> /about.php) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)$ $1.php [L] # Redirect .php URLs to extensionless ones (e.g., /about.php -> /about) RewriteCond %{THE_REQUEST} \s/+([^\s]+)\.php[\s?] [NC] RewriteRule ^ %1 [R=301,L] # Disable directory listing Options -Indexes