regex – URL rewrite with "+" sign (equals Google+) .htaccess

Question:

I would like to write a rule in .htaccess with RewriteRule using the plus sign (+) for a url in Google-like format, like this:

meusite.com.br/+someone was interpreted meusite.com.br/?track=alguem or meusite.com.br/umapagina+alguem was interpreted meusite.com.br/umapagina?track=alguem

Thank you in advance for your help.

Answer:

RewriteEngine on
RewriteBase /
RewriteRule ^\+(.*)$ /?track=$1 [L]
RewriteRule ^(.*)\+(.*)$ /$1?track=$2 [L]
Scroll to Top