Reputation: 115
I did my best to search in stack overflow questions and answers and even when I tried to apply a solution, it is not working.
I need to redirect all adresses, that begin with
http://www.example.com/index.php?lang=XX
to
This is what I try:
RewriteCond %{HTTP_HOST} ^www.example\.com [NC]
RewriteRule ^(index\.php\?lang\=)$ http://www.example.com/$1 [L,R=302]
The location /index.php?lang=en is not redirecting /en (anywhere). It is at the same URL.
Upvotes: 0
Views: 633
Reputation: 2900
You can't match a query_string in a rewriterule. You need a specific RewriteCond for it. It should be more or less like this:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{QUERY_STRING} ^lang=(.*)
RewriteRule ^ http://www.example.com/%1 [R=302,L,QSD]
Upvotes: 1