I created an htaccess URL rewrite to change my URL webseite.com/dashboard.php to webseite.com/dashboard.
My problem is that when I visit certain sites of my website (like https://example.com/detail_user.php?id=1
), I provide parameters via the url (using in database data).
According to my rewrite rules, it ignores parameters added to the URL.
Is there any htaccess rule that can provide parameters to a url but remove the .php ending when accessing a normal site?
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^/]+)/$ .php
I think what you are looking for is append[QSA].
QSA means "query string append", if a query string was passed in the original URL, it will be appended to the rewrite.
In your use case,
/detail_user.php?id=1
becomes/detail_user?id=1