IIS 8.5禁用虚拟应用程序的重写规则

时间:2018-06-21 10:45:27

标签: iis url-rewrite-module

我有一个在IIS 8.5上运行有多个“虚拟应用程序”的站点。我想运行我的主要网站e.x。 HTTPs上的www.example.com。虚拟应用程序只能在HTTP上运行。 e.x. www.example.com/cars、www.example.com/trucks、www.example.com/bikes等。

我在主站点web.config中有此规则

<rule name="http to https" enabled="true" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="^OFF$" />
    <add input="{REQUEST_URI}" pattern="^/cars/" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/trucks/" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/bikes/" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/heavy-vehicles/" negate="true" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>

但是使用此规则,虚拟应用程序可以同时在HTTP和HTTPs上运行

https://www.example.com/cars/
http://www.example.com/cars/

https://www.example.com/trucks/
http://www.example.com/trucks/

https://www.example.com/bikes/
http://www.example.com/bikes/

https://www.example.com/heavy-vehicles/
http://www.example.com/heavy-vehicles/

请帮助我修复虚拟应用程序,该应用程序应强制从HTTP重定向到HTTP

谢谢 帕拉格

0 个答案:

没有答案