RewriteEngine on # Rewrite rule to remove the .php extension from URLs RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^\.]+)$ $1.php [L] # Error document redirect ErrorDocument 404 /404.php