尝试使用 IIRF 重写排除 css 和 js 文件
我试图让 IIRF 工作,以便它重写某些 URL,但忽略 .css
和 .js
文件等文件。
我有这样的 URL:
/admin/
/admin/user/
/admin/user/view-details/1
/admin/user/view-details/1?edit
哪些都有效,但我似乎无法让它工作:
/admin/_assets/css/admin.css
我的 .ini
文件看起来像这样:
RewriteRule /admin/([^/]+)/([^/]+)/([^/]+)\?edit$ /admin/index.php?edit&action=$1&sub-action=$2&id=$3 [L,I,QSA]
RewriteRule /admin/([^/]+)/([^/]+)/([^/]+)$ /admin/index.php?edit&action=$1&sub-action=$2&id=$3 [L,I,QSA]
RewriteRule /admin/([^/]+)/$ /admin/index.php?action=$1 [L,I,QSA]
RewriteRule ^/admin/(.*)$ - [L]
我也尝试过:
RewriteRule (.+\.)(php|jpg|png|jpeg|gif|ttf|sql|txt|htm|zip|css)$ - [L]
我尝试过的东西给出了当我直接导航到 css 文件时,会出现一个空白文档,或者我得到:
HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
我对 IIRF 或 IIS 没有太多经验,所以我对接下来要尝试的内容有点困惑。我是不是找错地方了?或者我犯了一个非常基本的错误?
谢谢
I'm trying to get IIRF working so that it rewrites certain URLs, but ignores files like .css
and .js
files.
I have URLs like:
/admin/
/admin/user/
/admin/user/view-details/1
/admin/user/view-details/1?edit
Which all work, but I can't seem to get this to work:
/admin/_assets/css/admin.css
My .ini
file looks like this:
RewriteRule /admin/([^/]+)/([^/]+)/([^/]+)\?edit$ /admin/index.php?edit&action=$1&sub-action=$2&id=$3 [L,I,QSA]
RewriteRule /admin/([^/]+)/([^/]+)/([^/]+)$ /admin/index.php?edit&action=$1&sub-action=$2&id=$3 [L,I,QSA]
RewriteRule /admin/([^/]+)/$ /admin/index.php?action=$1 [L,I,QSA]
RewriteRule ^/admin/(.*)$ - [L]
I've also tried:
RewriteRule (.+\.)(php|jpg|png|jpeg|gif|ttf|sql|txt|htm|zip|css)$ - [L]
The things I've tried give either a blank document when I navigate directly to the css file, or I get:
HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
I don't have much experience with IIRF or IIS, so I'm a bit stuck with what to try next. Am I looking in the wrong place? Or have I made a really basic mistake?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调试 iirf 的提示:使用
StatusUrl< /code>
首先检查问题。
Tip for debugging iirf: use
StatusUrl
to check first for problems.我已经通过添加:
到我的文件顶部来解决这个问题。我仍然不确定为什么没有记录任何内容,但这解决了我的需要。
I've managed to fix this by adding:
to the top of my file. I'm still not sure why nothing is being logged, but this fixed it for my needs.