I would like to have to following rewrite rule:
- The query string must begin with choice1 or choice2
- The query string contains only one other value
- The domain should be path of the final url
- The final url should not contain the query string.
- The final url should contain the two values of the query string in its path
I have this so far (with help from here):
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(choice1|choice2)&([^&.]+) [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?([^\.]+)\..+$ [NC]
RewriteRule ^ https://www.mysite.de/link/%1/%2/%3 [L,NE,R=302]
The conditions work fine. But the final url does not contain the values of the query string (%1 and %2). Also the query string is appended, although I do not use the QSA-Flag.
Some examples:
first-domain.de?choice1&abc => https://www.mysite.de/link/choice1/abc/first-domain
first-domain.de?choice2&xyz => https://www.mysite.de/link/choice2/xyz/first-domain
second-domain.de?choice1&ttt => https://www.mysite.de/link/choice1/ttt/second-domain
second-domain.de?choice2&xyz => https://www.mysite.de/link/choice2/xyz/second-domain