Apache cheatsheet

301 redirect from http to https:

<VirtualHost 127.0.0.2:80 >
    ServerName www.domain.ltd
    ServerAlias www.domain.ltd domain.ltd
    ServerAdmin webmaster@domain.ltd
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</VirtualHost>
more ...