Apache自动跳转到HTTPS
最后更新于:2019-05-25 17:31:39
网站根目录新建.htaccess
。
写入以下内容:
方法一
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
方法二
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^niaoyundemo.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.niaoyundemo.com [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]