htaccess删除base 64编码的url符号

i just noticed this recently..

i use urlencode on base64 encoding to send encrypted image link across url's , so there are a few %2B's ie + symbols in the url.

when i access the url through GET in php

image.php?q={encoded}

and when i do $_GET['q'] i get the correct data without urldecoding it, ie %2B would have been translated as + etc....

but i recently wrote a htaccess doing like this

 RewriteRule ^image/(.*)?$ image.php?q=$1 [NC,L]

and when i access the $_GET['q'] data...all the %2B's have been replaced with spaces etc....so i need to run

str_replace(' ','+',$_GET['q']) 

and then decrypt to get image link..

Any idea why this is happening ?...do i need to set some default standard in htaccess or so ? any help is appreciated guys.

The rewrite rule does decode the URL with the Percent-Escape-Sequences, and the decoded string is put into the query string again, with "%2B" being now "+", and PHP decodes them to " " (space).

mod_rewrite has a flag for this: B

See the docs: http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_b