不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
IIS7实现访问http自动跳转到https图解
编辑:dnawo 日期:2019-10-16
先确定下你的IIS7有没有"URL重写"功能,如果没有需到官网下载安装URL重写工具。

安装URL重写工具
URL重写工具下载地址:https://www.iis.net/downloads/microsoft/url-rewrite



添加URL重写规则







此时站点根目录下多出一个web.config文件:
访问试下,http已经可以自动跳转到https了^_^
引用内容
参考资料
[1].URL Rewrite Module 2.0 Configuration Reference:https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-20-configuration-reference
[2].IIS配置Url重写实现http自动跳转https的重定向方法(100%解决):https://www.jianshu.com/p/9e00b4c03d70
[3].IIS7如何实现访问HTTP跳转到HTTPS访问:https://www.cnblogs.com/xiefengdaxia123/p/8542737.html
[4].详解IIS中的重写工具下关于操作重定向URL中的{R:N}与{C:N}:https://shiyousan.com/post/635648886502897428

安装URL重写工具
URL重写工具下载地址:https://www.iis.net/downloads/microsoft/url-rewrite



添加URL重写规则







此时站点根目录下多出一个web.config文件:
复制内容到剪贴板
程序代码

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^off$" />
<add input="{HTTP_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^off$" />
<add input="{HTTP_HOST}" pattern="^(localhost)" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
访问试下,http已经可以自动跳转到https了^_^

Back-references to condition patterns are identified by {C:N} where N is from 0 to 9; back-references to rule pattern are identified by {R:N} where N is from 0 to 9. Note that for both types of back-references, {R:0} and {C:0}, will contain the matched string.
参考资料
[1].URL Rewrite Module 2.0 Configuration Reference:https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-20-configuration-reference
[2].IIS配置Url重写实现http自动跳转https的重定向方法(100%解决):https://www.jianshu.com/p/9e00b4c03d70
[3].IIS7如何实现访问HTTP跳转到HTTPS访问:https://www.cnblogs.com/xiefengdaxia123/p/8542737.html
[4].详解IIS中的重写工具下关于操作重定向URL中的{R:N}与{C:N}:https://shiyousan.com/post/635648886502897428






评论: 0 | 引用: 0 | 查看次数: 2656
发表评论
请登录后再发表评论!