子域的IIS URL重写



我正试图在IIS中设置URL重写,它将接受来自根的请求https://www.test.com重定向到https://www.test.com/nfc/但是,当子域为"app"(例如。https://app.test.com)。

我已经用以下属性配置了IIS重写脚本:

请求URL:匹配模式使用:正则表达式图案:^$条件:{HTTP_HOST}与模式^app.test.com不匹配$操作类型:重定向重定向URL:/nfc/重定向类型:307

是否存在递归重定向导致请求崩溃的可能性。以下是IIS设置

你的规则有问题,你可以试试这个规则:

<system.webServer>
<rewrite>
<rules>
<rule name="test" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^app.test.com$" negate="true"/>
</conditions>
<action type="Redirect" url="/nfc" />
</rule>
</rules>
</rewrite>
</system.webServer>

最新更新