regex - htaccess RewriteRule, how do should it handle hex codes -


i have following line of code in .htaccess file:

rewriterule ^mypage/(.+)/$ mypage.php?a=$1 

this rewriterule works of time. however, if try passing parameter c++, mypage/c%2b%2b/ not work properly. should go mypage.php?a=c%2b%2b... instead seems mypage.php?a=c++ , the php code sees value of a=c<space><space>

how can update rewriterule pass hex coding rewritten url ?

thank in advance

trick use b flag. per manual:

the [b] flag instructs rewriterule escape non-alphanumeric characters before applying transformation.

read more here in doc.

your modified rule should this:

rewriterule ^mypage/(.+?)/?$ mypage.php?a=$1 [l,qsa,nc,b] 

Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -