To extend the answer to @quinxorin, you can also do the following.
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteCond %{REQUEST_FILENAME}\.php ^(.*)\.php(.*)$ RewriteRule .* %1.php?%2 [QSA]
This adds the rest of the URL to the result. those. /page/1234 becomes /page.php?1234 .
source share