# Turn on the rewrite engine
RewriteEngine On

# Ensure the request is not for an existing file
RewriteCond %{REQUEST_FILENAME} !-f
# Ensure the request is not for an existing directory
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite the request to the corresponding .php file
RewriteRule ^(.+)$ $1.php [L,QSA]