Redirect http to https apache

Tested on Debian.

Modify /etc/apache2/sites-enabled/000-default.conf:

        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
        #ServerAdmin webmaster@localhost
        #DocumentRoot /var/www/html

References