<rule name="Redirect to HTTPS" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTPS}" pattern="^ON$" />
<add input="{HTTP_HOST}" pattern="^([\d\w\.]+)" />
</conditions>
<action type="Redirect" url="https://{C:1}/{REQUEST_URI}" />
</rule>
<rule name="RedirectDoubleHTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://example.com" />
</rule>
答案 0 :(得分:0)
第二条规则中的问题。它应该是这样的:
<rule name="RedirectDoubleHTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://example.com{REQUEST_URI}" />
</rule>
此外,您的第一条规则还有一些小问题。相反,https://{C:1}/{REQUEST_URI}"
应为https://{C:1}{REQUEST_URI}"