如何在IIS 10上设置多个重定向规则



尝试在IIS服务器上配置重定向时遇到问题。我有一个在IIS中运行的网站,首先我想:

  • 重定向该网站的所有传入请求->https
  • 如果URL为https://abc.org到https://abc.org/loginpage,则重定向该网站的所有传入请求

我设置了第一条规则,如下所述:https://www.ssl.com/how-to/redirect-http-to-https-with-windows-iis-10/

然后设置第二条规则,如下所述:IIS 10 URL从一个域重定向到另一个

但它仍然不起作用。已尝试重新启动IIS、重新启动应用程序池、网站、清除浏览器缓存。。。谢谢

您可以尝试使用此URL重写规则:

<rewrite>
<rules>
<rule name="Test" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="https://example.com/loginpage" redirectType="Found" />
</rule>
</rules>
</rewrite>

您需要将example.com修改为abc.org.

最新更新