You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Srinivas Reddy <bh...@gmail.com> on 2017/09/05 17:11:19 UTC

[users@httpd] How to pass query string as encoded value to another parameter?

down votefavorite
<https://stackoverflow.com/questions/45984933/how-to-encode-query-parameters-using-apache-url-rewrite-rules#>

In my use case, I need to encode {QUERY_STRING} value and pass this value
as a separate parameter. Here it is how it should work:

http://www.example.com?param1=value1&param2=value2&param3=value3
<http://www.example.com/?param1=value1&param2=value2&param3=value3>

The URL can have n number of parameters and values may contain special
characters and value is an alphanumeric string.

I need to transform the URL to:

http://www.example.com?param1=value1&param2=value2&param3=value3&
<http://www.example.com/?param1=value1&param2=value2&param3=value3&>
*originalQP=param1=value1%26param2=value2%26param3=value3*

I added parameter called originalQP and it should be always encoded.

How can I get this encoded string using mod rewrite flags?

I tried using B and NE flags but neither of them worked. I am not getting
'&' being encoded in the transformed URL instead originalQP value is being
passed as param1=value1.

How can I get complete value?