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.
your modified rule should this:
rewriterule ^mypage/(.+?)/?$ mypage.php?a=$1 [l,qsa,nc,b]
Comments
Post a Comment