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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -