我正在尝试从表单中重写 url:
https://example.com/about
到表格
http://example.com/about
使用IIS7 URL 重写:
<!-- http:// to https:// rule -->
<rule name="ForceHttpsBilling" stopProcessing="true">
<match url="(.*)billing/(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
<!-- https:// to http:// rule -->
<rule name="ForceNonHttps" stopProcessing="true">
<match url="(.*)billing/(.*)" ignoreCase="true" negate="true" />
<conditions>
<add input="{SERVER_PORT}" pattern="^443$" />
</conditions>
<action type="Redirect" redirectType="Found" url="http://{HTTP_HOST}{REQUEST_URI}" />
</rule>
我不知所措;我一直在网上浏览示例并尝试我能想到的每一种语法。我指定的重写规则似乎根本不适用于任何 https 请求,好像所有请求https://
对重写引擎都是完全不可见的。
规则工作正常;请参阅下面的答案。