# ============================================================
#  Sandy Hook & CoCo — Apache configuratie (.htaccess)
#  Doel: 1 canonieke variant (https + www) en betere prestaties.
#  Let op: dit werkt op Apache-hosting. Draait je site op Nginx,
#  laat je hostingpartij dezelfde regels in de serverconfig zetten.
# ============================================================

RewriteEngine On

# --- Forceer HTTPS én www in één 301-redirect (geen redirect-ketens) ---
# Alles wat geen https is, of niet met www. begint, wordt doorgestuurd
# naar https://www.sandyhook.nl/<zelfde-pad>.
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.sandyhook\.nl$ [NC]
RewriteRule ^ https://www.sandyhook.nl%{REQUEST_URI} [L,R=301]

# --- Standaarddocument ---
DirectoryIndex index.html

# --- Eigen 404-pagina (optioneel; activeer als je een 404.html toevoegt) ---
# ErrorDocument 404 /404.html

# ============================================================
#  GZIP-compressie (kleinere HTML/CSS/JS = snellere laadtijd)
# ============================================================
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
  AddOutputFilterByType DEFLATE application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json application/xml
  AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# ============================================================
#  Browser-caching (statische bestanden langer bewaren)
# ============================================================
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType image/jpeg "access plus 6 months"
  ExpiresByType image/png "access plus 6 months"
  ExpiresByType image/webp "access plus 6 months"
  ExpiresByType image/svg+xml "access plus 6 months"
  ExpiresByType video/mp4 "access plus 6 months"
  ExpiresByType text/html "access plus 1 day"
</IfModule>

# ============================================================
#  Lichte beveiligingsheaders (geen SEO-risico)
# ============================================================
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
