我试图将端口80上的http请求重定向到IIS中端口443上的https请求。我有以下规则集:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<defaultDocument enabled="true">
<files>
<clear />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
<rule name="https">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern=".*" />
</conditions>
<action type="Rewrite" url="https://{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
当尝试通过http加载网站时,这将返回HTTP Error 403.14 - Forbidden
。
如何在重定向其他模式规则的同时重定向网站?