【发布时间】:2020-10-22 08:05:04
【问题描述】:
我使用下面的代码进行 http 到 https 的重定向,但不知道如何使用多个规则同时更新域和 https。
感谢您的帮助
<!--Examples-->
Example 1:
input : http://prodServer/MyApplication
Expected Output: https://prodServer.mycompany.com/MyApplication
Example 2:
input : https://prodServer/MyApplication
Expected Output: https://prodServer.mycompany.com/MyApplication
Example 3
input : http://prodServer.mycompany.com/MyApplication
Expected Output : https://prodServer.mycompany.com/MyApplication
代码
<system.webServer>
<rewrite>
<rules>
<rule name="httpsRedirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
【问题讨论】:
标签: asp.net url-rewriting web-config iis-10 url-rewrite-module