记录下常用的http跳转https的301配置,免得以后到处找
iis配置方式:
<?xml version="1.0" encoding="UTF-8"?>
<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配置方式:
rewrite ^(.*)$ https://$host$1 permanent; #最新版新增方法 return 301 https://$server_name$request_uri; #两种方法取一中
apache配置方式:
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://sulao.cn/post/558
相关阅读
- linux使用pdsh/pdcp批量操作服务器和批量编译nginx实际操作
- ubuntu22.04编译安装nginx
- flask使用nginx代理以后图片上传和加载问题解决方法
- nginx反向代理http/https、rpc/grpc、ws/wss
- nginx四层负载均衡配置解析以及卡顿问题的处理
- centos7部署k8s多master高可用集群(k8s/containerd/nginx/keepalived)
- k8s部署ingress-nginx
- docker部署keepalived非抢占单播模式
- docker-compose部署nginx反向代理tomcat
- docker-compose编排lnmp(nginx+php+mysql)环境
评论列表