Iis 7 https到http重定向不工作

Iis 7 https到http重定向不工作,iis-7,url-rewriting,Iis 7,Url Rewriting,我正在努力实现以下目标。 到 我已经使用了下面的重定向规则,它可以很好地用于http非www到http www重定向,但它不适用于https非www到http www重定向 <rule name="HttpsTOHttpRedirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{CACHE_URL}" pattern="^https://abc.com"

我正在努力实现以下目标。 到

我已经使用了下面的重定向规则,它可以很好地用于http非www到http www重定向,但它不适用于https非www到http www重定向

<rule name="HttpsTOHttpRedirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^https://abc.com" />
</conditions>
<action type="Redirect" url="http://www.abc.com{REQUEST_URI}" />


请帮帮我。

您删除
www
的规则可能有效,但您可以对其进行优化

要获得您想要的,您需要以下两条规则:

<rule name="Redirect to HTTP" stopProcessing="true">
  <match url=".*" />
  <conditions>
    <add input="{HTTPS}" pattern="^ON$" />
  </conditions>
  <action type="Redirect" url="http://{HTTP_HOST}/{R:0}" />
</rule>
<rule name="Add www if missing">
  <match url=".*" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="^www\." negate="true" />
  </conditions>
  <action type="Redirect" url="http://www.{C:0}/{R:0}" />
</rule>

如果是
https
请求,则第一条规则使用
http
重定向(使用反向引用保留原始url:
{R:0}

第二条规则在
www
丢失时追加它(使用2个反向引用来保留原始url:
{R:0}
{C:0}