包含排除子域

时间:2017-01-28 03:18:38

标签: iis url-rewriting

尝试设置重定向规则,除了一个子域和一个网页外,该规则会强制重定向所有内容:

<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    <add input="{HTTP_HOST}" negate="true" pattern="^www1\.mywebsite\.com$" ignoreCase="true" />
    <add input="{REQUEST_URI}" negate="true" pattern="^/file\.txt$" ignoreCase="true" />
  </conditions>
  <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
<outboundRules>
 <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
  <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" />
  <conditions>
      <add input="{HTTPS}" pattern="on" ignoreCase="true" />
  </conditions>
  <action type="Rewrite" value="max-age=31536000; includeSubDomains; preload" />
 </rule>
</outboundRules>             

0 个答案:

没有答案