温馨提示  2024年 6月我们已经停止开发者板块文章内容更新,谢谢来访。存档数据
知识 2023-08-24 48 次阅读

虚拟主机web.config 301 设置http跳转https

   

rewriteengine on

rewritecond %{https} !=on

rewriterule ^(.*)https://%{server,name}/$1[r,l]

<rewrite>

<rules>

<rule name=http redirect to https stopprocessing=true>

<match url=(.*) />

<conditions>

<add input={https} pattern=^off$ />

<add input={https,host} pattern=^(localhost) negate=true />

</conditions>

<action type=redirect url=https://{http,host}/{r:1} />

</rule>

</rules>

</rewrite>