views:

151

answers:

0

I'm using apache / mod_rewrite to re-write URLs but I am having problems with the plus sign.

With the following rule..

RewriteRule ^/(.+[^/])/?$ http://localhost:8080/app/home?tag=$1 [P,L] 

Both:

http://localhost/1+1 and http://localhost/1%2B2

end up as

uri=http://localhost:8080/app/home, args=tag=1+2

So in both cases the application translates the plus sign into a space so it cannot differentiate between spaces and plus signs anymore.

If I use the "B" flag, then in both cases the + signs are translated into %2B and the application ends up with the same problem but reversed (both spaces and plus signs are plus signs)

Is there a way to get apache to properly escape %2B into a plus sign and not a space?

I read something about mod_security but I am not using that so I am not sure if there is some other security mechanism that is causing this?

Any help would be greatly appreciated!