.htaccess RewriteCond 问题
我的 .htaccess 中有这个:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/includes
RewriteCond %{REQUEST_URI} !/images
RewriteRule (.*) index.php
它通过 index.php 重定向所有页面,但 include 和 images 文件夹除外。这是使用异常的正确方法吗?还有一种方法可以仅在一个 RewriteCond 规则上使用异常,而不是在单独的行上使用每个异常?
I have this in my .htaccess:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !/includes
RewriteCond %{REQUEST_URI} !/images
RewriteRule (.*) index.php
It redirects all pages through index.php with the exception of the includes and images folder. Is this the correct way to use the exceptions? Also is there a way to use the exceptions on just one RewriteCond rule instead of each on a seperate line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于例外情况来说这很好,尽管您可以在 ! 之间添加 ^ 。和 / 使其显示“开始于”。至于组合它们,您可以执行以下操作:
That is fine for the exceptions, though you could add a ^ inbetween the ! and / to make it says "starts with". As for combining them, you can do the following: