htaccess:重写冲突 - 简单的问题
这一行肯定会引起一点冲突,因为它会尝试重写目标本身:
RewriteRule ^/(.*)$ page.php?q=$1 [L,NC]
现在,我该如何防止这种情况发生?
This row will certainly cause a little collision as it will try to rewrite the goal itself:
RewriteRule ^/(.*)$ page.php?q=$1 [L,NC]
Now, how do I prevent this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需添加一个条件,即匹配的字符串与目标字符串不同:
这里,
RewriteCond
中的!=
表示否定的字典比较,而不是隐含的正则表达式比较。Just add a condition that the matched string is not the same as the destination:
Here the
!=
inRewriteCond
indicates a negated lexicographic comparison instead of the implied regular expression comparison.使用条件重写:
Using a conditional Rewrite: