urldecode with mod_rewrite

hype48505

New Member
I would like to decode requested URL via .htaccess/mod_rewrite and forward it to my PHP application. I am making request to some remote service and I need to preserve the URL for redirecting after processing the remote request. I am handling it over in forward GET parameter so I need to encode it via urlencode. I would like it decode then via .htaccess so there is no additional and wasting PHP request and I'm trying following:\[code\]RewriteCond %{QUERY_STRING} ^(.*)%3F(.*)$RewriteRule ^(.*)$ $1?%1&%2 [N]RewriteCond %{QUERY_STRING} ^(.*)%3D(.*)$RewriteRule ^(.*)$ $1?%1=%2 [N]\[/code\]And it works really weird. Second RewriteCond statement matches substring "%253D" and replaces it with the right "=" character. It's weird that it matches already encoded % (%25) while my rule contains only %. But further in the URL there is only %3D, which I also want to decode to =, but I don't know how.Thanks for any help.
 
Back
Top