Author Topic: 网站http改https  (Read 685 times)

newnewland

  • Administrator
  • Full Member
  • *****
  • Posts: 101
网站http改https
« on: October 02, 2024, 09:17:52 am »
1.一般的主机后台都有域名绑定,如果有免费的证书,先部署免费的证书(阿里云一个账号有20张,每张3个月,),部署后域名绑定那加载cdn  https就可以。

2.还有一种是htaccess改https安全连接方式:不过也要先验证是否有ssl链接:
https://www.sslshopper.com/ssl-checker.html




https://www.a2hosting.com/kb/security/ssl/redirecting-users-to-ssl-connections/


Add the following lines to the desired .htaccess file to redirect users from a non-secure URL (http://) to a secure URL (https://).

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


1. Redirect All Web Traffic
If you have existing code in your .htaccess, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]



----下面是写在具体网站的

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]
« Last Edit: October 02, 2024, 09:24:31 am by newnewland »