时间:2019-05-22 浏览量:
web.config实现http重定向跳转HTTPS,代码如下:
<rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="//{HTTP_HOST}/{R:1}" /> </rule>
web.config重定向带www的域名转向www域名规则,代码如下:
<rule name="不带www转向www域名规则" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^xmjdwx.cc$" ignoreCase="false" /> </conditions> <action type="Redirect" url="//www.xmjdwx.cc{R:1}" redirectType="Found" /> </rule>
RELATED RECOMMEND