登录 / 注册
配置http重定向https
发布时间:2023-02-02 15:49:51 查看:2297

IIS下

1、rewrite_amd64_zh-CN.msi安装

2、ASP.NET站可直接修改web.config。IIS控制台右键单击需要设置的站点,选择“浏览”,编辑Web.config文件。在system.webServer之间添加以下内容:

web.config
<configuration>
 <system.webServer>
 <rewrite>
 <rules>
 <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>
	

Nginx上把HTTP请求重定向到HTTPS请求

http {
    server {
        listen 80;
        server_name example.com www.example.com;
        # Redirect all port 80 (HTTP) requests to port 443 (HTTPS).
        return 301 https://example.com$request_uri;
    }

    server {
        listen 443 ssl;
        server_name example.com;
        ssl_certificate     /path/to/cert-crt.crt;
        ssl_certificate_key /path/to/cert-key.key;
        # all other site settings go here (e.g. ssl, logs, site root)
    }
}

宁夏银川舜新艺软件开发
ShunXinyi Soft develop
主要经营
软件开发,网站制作,网页设计,移动应用(安卓、苹果),微信,微网站,
FLASH动画,电子商务,计算机软硬件及网络设备等。
电话:18695132945 QQ:23923027
舜新艺软件开发 宁ICP备16001093号-1 宁公网安备 64010602000809号