- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="301" stopProcessing="true">
- <match url="^(.*)$" ignoreCase="false" />
- <conditions logicalGrouping="MatchAny">
- <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />
- <add input="{HTTP_HOST}" pattern="^www.idiyrom.com$" negate="true" />
- </conditions>
- <action type="Redirect" url="https://www.idiyrom.com/{R:1}" redirectType="Permanent" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
stopProcessing=”true”当执行规则操作(即匹配的规则)并打开此标志时,这意味着不再处理后续规则,并且请求将被传递到IIS请求管道。
ignoreCase=”false”忽略大小写
MatchAny 任意匹配,成功匹配到一个就执行action 相当于or
MatchAll 完全匹配,匹配所有规则,都成立才执行action 相当于and
negate=”true”代表取反,比如HTTP_FROM_HTTPS 不等于on 为真
例子一的含义是http跳转到https,比如https://idiyrom.com也会跳转到https://www.idiyrom.com
例子二
我有一个手机站m.idiyrom.com,不想跳转到https://www.idiyrom.com
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="301" stopProcessing="true">
- <match url="^(.*)$" ignoreCase="false" />
- <conditions logicalGrouping="MatchAll">
- <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />
- <add input="{HTTP_HOST}" pattern="^m.idiyrom.com$" negate="true" />
- </conditions>
- <action type="Redirect" url="https://www.idiyrom.com/{R:1}" redirectType="Permanent" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
文章评论 本文章有个评论