I want to redirect the following url

oldsite.com/index.htm?Page?somepath%2fsomefile

to

newsite.com/productindex.htm?p=somepath%2fsomefile

I have the following rules

RewriteCond %{QUERY_STRING} ^Page=(.*)$
RewriteRule ^index.htm$ http://newsite.com?p=%1 [R=301,NC,L]

But it redirects to

newsite.com/productindex.htm?p=somepath%252Fsomefile
>--------------------------------------^^^^^

There are a lot of references about a long standing bug with double escaping that was recently fixed (2.2.12 I think) and as I am running 2.2.9 I thought the RewriteRule B flag may help, but it makes it worse...

newsite.com/productindex.htm?p=somepath%25252Fsomefile
>--------------------------------------^^^^^^^

Any ideas from the Apache gurus?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Its the NE (No Escape) flag that I need

RewriteCond %{QUERY_STRING} ^Page=(.*)$
RewriteRule ^index.htm$ http://newsite.com?p=%1 [R=301,NC,L,NE]
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.