I want to hide the .php extension from all files and my regex is not working properly, it is redirecting the following /path/to/script.php?param1=test.php -> /path/to/script?param1=test
It is removing the ".php" from both the %{REQUEST_URI} and the %{parameters}.
Is there a way to stop at the first occurrence of the .php and replace just that?
Thanks.
Here is my .conf file:
<IfModule mod_rewrite.c>
RewriteEngine On
DirectorySlash On
# GET /path/to/script.php q=343434
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
# append .php to all paths
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule (.*) $1.php [L,QSA]
</IfModule>