虚拟主机实现http进行301跳转到https

首先在虚拟主机后台打开伪静态
然后网站根目录下建一个文件.htaccess,在文件里添加如下代码

RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R=301]

你可能感兴趣的:(https,网络协议,http)