今天在试着在IIS8.0上设置HTTPS,按照教程添加完成以后可以正常使用HTTPS服务,但是在设置HTTP重定向到HTTPS上的时候遇到了些问题,现在把问题解决过程记录一下。
- 在IIS中选择网站,然后单击功能窗格中的“URL重写”选项。URL重写页面打开以后单击右侧窗格中的“添加规则…”链接,选择空白规则点击确定,输入名称。
- Match URL 部分 :
- 设置 Requested URL 为 Matches the Pattern.
- 设置 Using 为 Regular Expression
- 设置 Pattern 为 (.*)
- Conditions 部分. 点击 添加
- 设置Condition Input为{HTTPS}
- 设置Check if Input String 为 Matches the Pattern
- 设置Pattern 为 ^OFF$
- 点击 确定
- Actions 部分
- 设置 Action Type 为 Redirect
- 设置 Redirect URL为 https://{HTTP_HOST}/{R:1}
- 设置 Redirect Type 为 Permanent(301)
- 点击应用
现在所有的请求都会被301重定向到HTTPS

《IIS 8 HTTP重定向到HTTPS》上有1条评论