<VirtualHost *:8080>
    # the document root -- /var/www/data/project/web
    DocumentRoot /var/www/data/project/web

    <Directory /var/www/data/project/web>
        # add types for .owl and .rdf
        AddType application/rdf+xml .owl
        AddType application/rdf+xml .rdf

        # Rewrite the 'ontology' directory
        RewriteEngine On
        RewriteOptions InheritDownBefore
        ReWriteRule ^(ontology/[^/]+/).+ $1 [R=303,END]
        ReWriteRule ^(ontology/[^/]+)/$ sites/default/files/$1.owl [END]

        # Allow overrides of symlinks
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    # Read the CONTENT_SECURITY_POLICY from the environment! 
    PassEnv CONTENT_SECURITY_POLICY
    Header set Content-Security-Policy %{CONTENT_SECURITY_POLICY}e "expr=-n osenv('CONTENT_SECURITY_POLICY')"

    # Don't low to allow ignoring everything
    ErrorLog /dev/stderr
    CustomLog /dev/stdout combined
</VirtualHost>
