apache2将http自动指向https

<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>


原文来自: http://stackoverflow.com/a/25211062
原文地址:https://www.cnblogs.com/Jim-william/p/5165676.html