Reputation: 2073
I am in a need of a 301-Redirect with the following example:
The pages
Should be redirected to
but i really do not understand how to solve that.
What i have tried:
RewriteCond %{query_STRING} ^id=(.*)$
RewriteRule https://www.example.com/ [R=301,L]
Upvotes: 1
Views: 894
Reputation: 786359
You need to use ?
at the end of target URI to strip off any existing query string. Also you can use a relative target URI also if target is on same domain.
Use this rule:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id= [NC]
RewriteRule ^(?:index\.php)?$ /? [R=301,L,NC]
Upvotes: 2