Home > apache, php > Plus sign in URL get parameter is received as a space

Plus sign in URL get parameter is received as a space

I’ve an URL like this:

http://www.example.com/example.php?page=one+two

My PHP script reads the page with $_GET([‘page’]), and the result is this, the plus sign is converted to an space:

one two

My server uses Apache/2.2.3 (CentOS) & PHP Version 5.2.14.
There’s an easy workaround using the [B] flag (escape backreferences) for mod_rewrite, as stated in the apache documentation:
http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_b
If I put the B flag to my RewriteRule I get this error:

RewriteRule: unknown flag 'B'

Because the B flag is available from apache version 2.2.7 onwards, so it’s the turn to update the apache server version!

Advertisements
Categories: apache, php Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: