John Baker John Baker - 1 year ago 127
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 Source

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.