<VirtualHost *:80>
    ServerName $HNAME
    ServerAdmin webmaster@localhost
    DocumentRoot $WWW_DIR

    DirectoryIndex index.php

    RewriteCond %{SERVER_NAME} =$HNAME
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>


<VirtualHost *:443>
    ServerName $HNAME
    ServerAdmin webmaster@localhost
    DocumentRoot $WWW_DIR

    DirectoryIndex index.php

    SSLEngine on
    SSLCertificateKeyFile   /etc/ssl/private/ssl-cert-snakeoil.key
    SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem

    <Directory "incl/">
        Options -Indexes
        Deny from all
    </Directory>
</VirtualHost>
