& symbol problem in htaccess
my current url is
categorie开发者_如何学Gos_name.php?cname=at&t
rewritten url like this.
carriers/at&t
this is htaccess url.
RewriteRule ^carriers/(.*)$ categories_name.php?cname=$1 [L]
above url is working for all like
categories_name.php?cname=all-tel
when variable(at&t) has '&' symbol then problem occuring. so how to write htaccess url?
Try it with the B flag for backreference escaping:
RewriteRule ^carriers/(.*)$ categories_name.php?cname=$1 [L,B]
&
is a separator between different arguments in the querystring. at&t
must therefore be urlencoded like this: at%26t
otherwise PHP will see it as if you had two arguments: cname
and t
精彩评论