We are on the way to develop a small router via the .htaccess file
.
Now we are trying to pass through a get-parameter in a rewrite_rule. The problem is, that the get parameter is not passed through successfully.
For example we have the following url:
https://example.com/shop-verifizierung_2c1c759546318feb3177d7d2a023400a.html
and the following rule:
RewriteRule ^(.*)-verifizierung_(.*).html$ index.php?seite=$1&webshopparameter=verifizierung&code=$2 [L,QSA]
That example works fine and the parameters are set correctly but now we have to add an additional get-parameter token
like that:
https://example.com/shop-verifizierung_2c1c759546318feb3177d7d2a023400a.html?token=6TT38831GN100844
So we expand the rewrite_rule:
RewriteRule ^(.*)-verifizierung_(.*).html?token=(.*)$ index.php?seite=$1&webshopparameter=verifizierung&code=$2&token=$3 [L,QSA]
^^^^^^^^^^^^ ^^^^^^^^^
But it wont work as expected. We also tried to use {QUERY_STRING} but the result is thesame. Where is the problem here? Thanks for your help!
With your shown samples, please try following htaccess Rules. You could use THE_REQUEST
variable which will be more suitable more your current condition here.
Also please make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{THE_REQUEST} \s/(.*?)-verifizierung_(.*?)\.html\?token=(\S+)\s [NC]
RewriteRule ^ index.php?eite=%1&webshopparameter=verifizierung&code=%2&token=%3 [L,QSA]