IIS7的http 做301重定向到https
http跳转到https
这个代码段是http重定向到https, 注意,要放在<rules>和</rules>之间。
<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="https://{HTTP_HOST}/{R:1}" /> </rule>
http跳转到https
提醒:里面的网址记得改成你自己的网站,别懒得只会copy!
这个代码段是无3w重定向到有3w域名, 注意,要放在<rules>和</rules>之间。
<rule name="www" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^xxx\.com$" /> </conditions> <action type="Redirect" url="https://www.xxx.com/{R:0}" /> </rule>