<VirtualHost *:443>

    DocumentRoot /var/www/baikal/html
    ServerName dav.example.org

    RewriteEngine on
    # Generally already set by global Apache configuration
    # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule /.well-known/carddav /dav.php [R=308,L]
    RewriteRule /.well-known/caldav  /dav.php [R=308,L]

    <Directory "/var/www/baikal/html">
        Options None
        # If you install cloning git repository, you may need the following
        # Options +FollowSymlinks
        AllowOverride None
        # Configuration for apache-2.4:
        Require all granted
        # Configuration for apache-2.2:
        # Order allow,deny
        # Allow from all
    </Directory>

    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>

    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/dav.example.org/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/dav.example.org/privkey.pem

</VirtualHost>


#<VirtualHost *:80>
#
#    DocumentRoot /var/www/baikal/html
#    ServerName dav.example.org
#
#    RewriteEngine On
#    RewriteRule /.well-known/carddav /dav.php [R,L]
#    RewriteRule /.well-known/caldav /dav.php [R,L]
#
#    <Directory /var/www/baikal/html>
#        Options None
#        Options +FollowSymlinks
#        AllowOverride All
#
#        # Confiugration for apache-2.2:
#        Order allow,deny
#        Allow from all
#
#        # Confiugration for apache-2.4:
#        Require all granted
#    </Directory>
#
#</VirtualHost>
