views:

30

answers:

2

I need help, again.
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]

Thank you

A: 

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.

JochenJung
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.
Vera
A: 

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

Vera