1

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

1 Answer 1

1

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]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. First one is working. Now I see my mistake.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.