Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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