# Zet dit bestand als .htaccess in de hoofdmap van de site (met de punt ervoor).
ErrorDocument 404 /404.html

# Interne bestanden nooit tonen
<FilesMatch "(\.md|\.json|\.bak|\.txt|~)$">
    Require all denied
</FilesMatch>
<Files "robots.txt">
    Require all granted
</Files>
<Files "producten.json">
    Require all granted
</Files>

AddType image/webp .webp
AddType font/woff2 .woff2

<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    <FilesMatch "\.html$">
        Header set Cache-Control "no-cache, must-revalidate"
    </FilesMatch>
    <FilesMatch "\.(css|js|woff2)$">
        Header set Cache-Control "public, max-age=31536000"
    </FilesMatch>
    <FilesMatch "\.(jpg|jpeg|png|webp|svg|gif|pdf)$">
        Header set Cache-Control "public, max-age=86400"
    </FilesMatch>
</IfModule>

RewriteEngine On
# Altijd https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Kies een vorm: dit voorbeeld stuurt www.voorbeeld.nl door naar voorbeeld.nl
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# Schone adressen: /over-ons toont over-ons.html, /over-ons.html stuurt door naar /over-ons
DirectorySlash Off
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+?)/?$ $1.html [L]
RewriteCond %{THE_REQUEST} \s/([^.?\s]+)\.html[\s?]
RewriteRule ^ /%1 [R=301,L]
