Reputation: 43
I find many solutions for similar case, but I can't find any for this one. I have some old urls with parameters to permanently redirect on homepage. There is example:
#old url https://www.example.com/?s=141&sid=5
#new url https://www.example.com
I'm trying to do some like this, but I can't find out how to make it works:
RewriteCond %{QUERY_STRING} ^s=141&sid=5
RewriteRule ^(.*)$ https://www.example.com [R=301,L]
This is not working either
Redirect 301 /?s=141&sid=5 https://www.example.com
Upvotes: 1
Views: 1622
Reputation: 7476
Try it like this,
RewriteCond %{QUERY_STRING} ^s=141&sid=5$
RewriteRule ^ https://www.example.com? [R=301,L]
or if not working above
RewriteEngine on
RewriteCond %{QUERY_STRING} ^s=([\d+])&sid=([\d+])$
RewriteCond %1 ^141$
RewriteCond %2 ^5$
RewriteRule ^ http://example.com? [R=301,L]
Upvotes: 1