【发布时间】:2019-09-14 21:02:38
【问题描述】:
我的 IIS 中有以下用于 url 重写的配置
<rewrite>
<rules>
<rule name="Rewrite CI Index">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html|csv|ttf|woff|woff2|pdf|mp4|mov|ics" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(php_scripts)" negate="true" />
<add input="{REQUEST_URI}" pattern="^/documents/intranet_documents/" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
negate 指令用于防止重写网站资产文件(css、字体等)以及来自文档上传/下载部分的其他文件。
我刚刚遇到的问题是,其中一个网址是这样的 http://intranet/HR/Training-Basics 但是当我尝试导航到此网址时,我得到 404,因为它被文件扩展名 ics 的 negate 函数捕获。
所以,我需要能够访问此 url,但同时我需要能够下载“ics”文件。最好的方法是什么?
【问题讨论】:
标签: iis url-rewriting