我有一个运行https的网站。现在一些程序员需要一个没有https的子程序。
这是我现在在我的 web.config 中拥有的内容:
<rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我们需要从此https重定向中排除文件夹"wp-content\rest"。
希望有人可以帮助我解决这个问题。
您需要在规则中添加一个附加条件:
<rule name="HTTP Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
<add input="{REQUEST_URI}" pattern="^/wp-content/rest" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
然后,此规则将禁用重定向到所有网址,例如http://www.example.com/wp-content/rest*