全站HTTP跳转HTTPS

By | 2017年10月5日

在网站根目录的.htaccess文件中写入:

<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
</IfModule>