进入站点主页 IIS->URL重写功能->添加规则
参考文档:https://blog.csdn.net/hzy694358/article/details/89215237
名称:输入规则名称
匹配URL:
模式匹配 正则表达式
^(.*)$
条件:
{HTTPS} ^OFF$ :如果本来就是https强求就结束本跳转
{HTTP_HOST} ^zzy.cn :host必须以指定域名开头
操作类型 选择 重定向,
重定向URL:
重定向类型:根据需要 选择301 或者302
IIS 配置文件里的设置:
<rule name="redirect_https_1" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^zzy.cn" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
redirectType="Permanent" ---------永久301
redirectType="Found" ---------临时302