iis - IIS URL 重写规则排除多个文件
问题描述
我有一个强制 HTTPS 的 IIS URL 重写规则,除非该页面是 healthcheck.html(超过端口 80)。当我使用匹配 URL 逻辑时,这就像一个魅力,如下所示:
<match url="healthcheck.html" negate="true" />
但是,我不仅需要排除此页面,还需要排除名为 Dir1 的目录中名为 OtherCheck.aspx 的第二个文件
我没有发现其他人排除了两个文件的任何实例,尤其是一个不在根目录中的文件。是否可以有两个文件名排除项?我试过了,但没有奏效:
<match url="healthcheck.html&/Dir1/OtherCheck.aspx" negate="true" />
解决方案
文件和文件夹结构:s1(根文件夹):
健康检查.html(文件)
s2(子文件夹):
page1.html(文件)
您可以使用以下 url 重写规则来排除多个文件:
<rule name="Redirect to HTTPS multiple file" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="off" />
<add input="{REQUEST_URI}" pattern="^/healthcheck.html" negate="true" />
<add input="{REQUEST_URI}" pattern="^/s2/page1.html" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
https重定向:
注意:您可以根据需要设置文件和文件夹名称。
问候, 雅尔帕
推荐阅读
- python - 我从列表创建字典的函数将值重复三次而不是一次
- firebase - 如何重新验证在firebase中使用电话号码登录的用户?
- assembly - AT&T 语法中的 resd 指令
- javascript - 如何将 PayPal 的智能按钮添加到现有的 JavaScript 购物车?
- ruby-on-rails - 需要 Rails 控制器设计帮助
- node.js - 在 AWS Lightsail 中找不到运行 Nodejs 的模块“TronWeb”
- excel - 为什么我的 VBA 代码不附加数据而是替换工作簿中的数据?
- wrapper - 如何通过 python 将许可证请求包装到 drmtoday 服务器
- node.js - nsolid 堆快照和 cpu 配置文件未出现在控制台中
- mongodb - 如何在单独的主机中配置 Rocket Chat 和 MongoDB?