how to stop RedirectRule decode "%26" to "&"

Feb 25, 2010 at 2:11 AM

I am using the IIRF Rewriter Version 2.0. I don't know how to stop the RedirectRule to decode "%26" to "&".

I have the url with querystring, and I have the follwing code in .ini file

RewriteCond  %{HTTP_HOST}            ^www\.oldserver\.com$ [I,OR]
RewriteCond  %{HTTP_HOST}            ^oldserver\.com$ [I]

RewriteCond %{query_string} .
RedirectRule ^/firstpath/secondpath/testpage.aspx?(.*)$ http://newserver.com/firstpath/secondpath/testpage.aspx$1 [I,R=301]

It works fine if the original url have no "%26"in it, eg, http://oldserver.com/firstpath/secondpath/testpage.aspx?category=book   will be redirect to http://newserver.com/firstpath/secondpath/testpage.aspx?category=book

But if the original URL have %26 in one of the parameter value of the querystring, eg http://oldserver.com/firstpath/secondpath/testpage.aspx?category=book&title=maths%20%26%20science, it will redirect to http://newserver.com/firstpath/secondpath/testpage.aspx?category=book&title=maths%20&%20science which causes my application to do wrong thing as it reads "title=maths" only.

So how can I write the RedirectRule to cater for both cases as above?