Rewriting QueryString and escaping characters

Apr 8, 2011 at 7:28 PM
Edited Apr 8, 2011 at 7:45 PM



I'm using Rewriting to make my messy file structure look more base app we'll say is located at

I have a rewrite rule, that is something like this

RewriteCond %{HTTP_HOST} ^(?!www)myApp\.myServer\.com [I]
RewriteRule ^/(.+)$ /myApp/v1/otherStuff/$1 [L]

I've got IIRF rewriting a bunch of stuff wonderfully, but here's where a problem lies that I don't know how to fix...when a request comes in like this

it's rewriting but it's decoding the %26% and not re-encoding it, so it rewrites to

where I would like it to rewrite to

(notice the encoded amperstamp)

This is obviously a slight problem as it destroys any query string i have with any encoding

What am I missing?



I accidently put this in the issue tracker, but can't delete it now...sorry :-(

Apr 8, 2011 at 7:58 PM

I read that you made a fix in 2007 so that you could escape that using double %% signs...It kindof works


1) When I pass in "This & That" thru the query string, the server obviously only gets the "This " portion of it.

2) When I pass in "This+%26+That" thru the query string, the Rewrite rule will rewrite it back to "This & That" and i'm stuck with 1)

3) When I pass in "This+%%26+That" DoRewrites does not decode it, so I'm stuck with %%26, and the server gets "This %& That".

Apr 8, 2011 at 8:05 PM

After more searching and reading I found there was an option to turn of UrlDecoding


UrlDecoding OFF


that fixed all my troubles, thanks and sorry for posting

Apr 9, 2011 at 8:51 AM

right, glad it's working for you now.