RewriteCond不明白怎么申请!
。
RewriteRule ^articles/([0-9]+)-(.*)\.html$ article.php?id=$1 [L]
RewriteRule .* index.php
由于 .htaccess 中的 [L] 问题,我仍然不明白如何应用 RewriteCond 帮助!并提前致谢:)
I have this
RewriteRule ^articles/([0-9]+)-(.*)\.html$ article.php?id=$1 [L]
RewriteRule .* index.php
I still don't understand how to apply RewriteCond, due to [L] issues in .htaccess. Help!and thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于 serverfault 有一个很好的参考问题,它解释了规则和条件如何相互作用:
您的一切曾经想了解 Mod_Rewrite 规则但又不敢问吗?
按照 Meta 当前讨论建议的链接。
There is an excellent reference question on serverfault, which explains how rules and conditions interact:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?
Link as advised by current discussion on Meta.
我猜您正在寻找类似的内容:
另一个解决方案是使用第二个
RewriteRule
的模式排除article.php
:但请注意,这将重写 任何其他请求(包括其他现有文件)。为了解决这个问题,您可以对第二条规则使用不同的条件:
I guess you’re looking for something like this:
Another solution would be to exclude
article.php
with the pattern of the secondRewriteRule
:But note that this will rewrite any other request (including other existing files). To conquer that you could use a different condition for the second rule: