Add Full QueryString as a Url Encoded Param

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Add Full QueryString as a Url Encoded Param

23 Aug 2012, 21:16

I would like to add the full input url as a param to my querystring, but this would have to be url encoded in order for my page to see it as one value:

Here is what i have so far:


RewriteProxy ^(/help/(mySpecificPage)/?\?(.*)) http://www.mySite.com/page.aspx?name=$2 ... origUrl=$1 [D,U,I]


I capture the entire url as $1 - but is there a way for me to add it as something like &origUrl=[url]$1[/url] ?

Thanks!

User avatar
Posts: 19
Joined: 21 Mar 2012, 06:22

Re: Add Full QueryString as a Url Encoded Param

24 Aug 2012, 10:54

programmer27 wrote:I would like to add the full input url as a param to my querystring, but this would have to be url encoded in order for my page to see it as one value:

Here is what i have so far:


RewriteProxy ^(/help/(mySpecificPage)/?\?(.*)) http://www.mySite.com/page.aspx?name=$2 ... origUrl=$1 [D,U,I]


I capture the entire url as $1 - but is there a way for me to add it as something like &origUrl=[url]$1[/url] ?


Unfortunately, there is no way to do exactly that, because ISAPI_Rewrite does not do any urlencoding. But, you could copy HTTP_X_REWRITE_URL value into a custom header and this header will be passed along with a proxy request. So, you will be able to get it.

User avatar
Posts: 7
Joined: 23 Aug 2012, 21:09

Re: Add Full QueryString as a Url Encoded Param

27 Aug 2012, 08:47

Can you show me how to do this, I am having trouble with the syntax. Thanks!

User avatar
Posts: 19
Joined: 21 Mar 2012, 06:22

Re: Add Full QueryString as a Url Encoded Param

27 Aug 2012, 14:57

programmer27 wrote:Can you show me how to do this, I am having trouble with the syntax. Thanks!


For example,

Code: Select all
RewriteCond X-Rewrite-URL: (.+)
RewriteHeader X-Original-URL: .* $1


Then you will be able to get the original URI from the X-Original-URL header.

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 9 guests