.htaccess 重写简单的正则表达式问题
我目前有这样的规则:
RewriteRule ^Listing/([a-zA-Z]+)/([a-zA-Z]+)/([a-z0-9]+)$ He_Listed.php?city=$1&area=$2&list=$3 [NC,L]
这对于诸如以下的地址效果很好,
http://www.mysite.co.uk/Listing/UK/London/44
但不适用于:
http://www.mysite.co.uk/Listing/UK/London_Bred/44
因为下划线。我必须在上面的正则表达式中做出什么改变 为了完成这个?第二个“([a-zA-Z]+)”应该变成什么?
I currently have this rule:
RewriteRule ^Listing/([a-zA-Z]+)/([a-zA-Z]+)/([a-z0-9]+)$ He_Listed.php?city=$1&area=$2&list=$3 [NC,L]
This works well for an address such as:
http://www.mysite.co.uk/Listing/UK/London/44
but doesn't for:
http://www.mysite.co.uk/Listing/UK/London_Bred/44
Because of the underscore. What change would i have to make in the above regex in
order to accomplish this? The second "([a-zA-Z]+)" should be turned into what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应从 [a-zA-Z]+ 变为 [a-zA-Z_]+
should be turned from [a-zA-Z]+ to [a-zA-Z_]+