更新時(shí)間:2023-03-08 編輯:創(chuàng)始人 關(guān)注人次:0 新格搜索
web.config實(shí)現(xiàn)http重定向跳轉(zhuǎn)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="https://{HTTP_HOST}/{R:1}" />
</rule>
web.config重定向帶www的域名轉(zhuǎn)向www域名規(guī)則,代碼如下:
<rule name="不帶www轉(zhuǎn)向www域名規(guī)則" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^mobanjia.cn$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="https://www.mobanjia.cn{R:1}" redirectType="Found" />
</rule>
模板家跳轉(zhuǎn)使用的是如下代碼:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="不帶www轉(zhuǎn)向www域名規(guī)則" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^jz1.com.cn$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="https://www.jz1.com.cn/{R:1}" redirectType="Found" />
</rule>
<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>
</rules>
</rewrite>
</system.webServer>
</configuration>