2

I am trying to do the redirect, but it is not working.

I want to redirect:

http://www.example.com/page/168?s  

To:

http://www.example.com/page/168

Using

RewriteCond %{QUERY_STRING} ^q=s$  
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]

2 Answers 2

1

I found the solution:

RewriteCond %{QUERY_STRING} ^s$  
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L]    

In case of somebody to need

Thank you

Sign up to request clarification or add additional context in comments.

Comments

0

You need QSA (Query string append):

Using RewriteCond %{QUERY_STRING} ^q=s$
RewriteRule ^(.*)$ http://www.example.com/$1? [R=301,L,QSA]

Otherwise the the rewrite does not include the part after the questionmark.

1 Comment

Thank you for the answer. Didn't work. The log doesn't show any error but it doesn't redirect. The "s" after the questionmark was not excluded.

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.