John Baker John Baker - 3 months ago 17
Apache Configuration Question

Escaping equals signs, plus sign and slashes from mod_rewrite

I'm passing a base64 encoded parameter using GET. After converting to base64 I end up with a string that contains slashes, plus and equals signs that break my mod_rewrite rule. My mod_rewrite rule is

RewriteEngine on
RewriteRule ^page/(\w+)$ page.php?code=$1


The code parameter is base64. Is there any way to escape those characters automatically?

Answer

Try using [B] flag but i am not sure either

RewriteRule ^page/(\w+)$  page.php?code=$1 [B]

The [B] flag instructs RewriteRule to escape non-alphanumeric characters before applying the transformation.

http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_b

Comments