<VirtualHost *:80>
    ServerName offstream.lencraftserver.de
    Redirect permanent / https://offstream.lencraftserver.de/
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName offstream.lencraftserver.de
    DocumentRoot /var/www/offstream

    ErrorLog ${APACHE_LOG_DIR}/offstream-error.log
    CustomLog ${APACHE_LOG_DIR}/offstream-access.log combined

    <Directory /var/www/offstream>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    RewriteEngine On
    RewriteCond %{QUERY_STRING} (^|&)utm_ [NC]
    RewriteRule ^ - [E=HAS_UTM:1]
    CustomLog /var/log/apache2/utm_access.log combined env=HAS_UTM

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/offstream.lencraftserver.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/offstream.lencraftserver.de/privkey.pem
</VirtualHost>
</IfModule>
