The "+" character is reserved in the query string line of the URL as a space. In fact, the status “+” as a reserved character is documented in rfc3986 , and its (now obsolete) use as a space replacement character is documented in rfc1630 .
Since Apache tries to avoid conflict, it automatically preempts the + as a string before passing it.
Using the [NE] (NoEscape) in your rewriting should prevent this behavior.
RewriteRule ^invite/([a-zA-Z0-9\-\+\/]+)/?$ invite.php?key=$1 [L,NE,QSA]
However, using this, the unescaped "+" WILL will be replaced with a space if the user manually enters the URL. To be safe, simply replace all spaces in your input with + signs.
Quite frankly , since you do not accept spaces at your input, simply replace all spaces with the "+" character. Using the [NE] flag can cause big problems and then replace a simple character. Simple $_GET['key'] = str_replace($_GET['key'], ' ', '+'); should be enough.
Andrew Moore
source share