正则表达式、modrewrite php apache
任何人都可以看到这个问题吗?
url通常是这样的:
page_test.php?page=latest_news&id=10518271191304876236
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ page_test.php?page =$1&id=$2
非常感谢
can any one see the problem with this?
the url is this normally:
page_test.php?page=latest_news&id=10518271191304876236
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ page_test.php?page=$1&id=$2
many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的网址中没有
/
,并且您的模式需要一个:基本上您正在搜索:
There's no
/
in your URL, and your pattern is requiring one:basically you're searching for:
由于下划线
_
,latest_news 与[a-zA-Z0-9]
不匹配:您可以使用单词字符类\w
,其中包含下划线:如果
id
始终为数字,您可以使用数字字符类\d
进一步缩短它:latest_news is not matched by
[a-zA-Z0-9]
because of the underscore_
: you could use the word character class\w
, which includes the underscore:If the
id
is always numeric, you could shorten it even more using the number character class\d
:您应该从以下位置致电:
and you should be calling from: