# Statische site (alleen HTML, CSS, JS en afbeeldingen). Geen PHP of database.
# Dit bestand vervangt een eventuele oude .htaccess in de webroot.

# index.html gaat voor op index.php.
DirectoryIndex index.html

# Eigen foutpagina in plaats van de kale Apache-melding.
ErrorDocument 404 /404.html

# Bestanden in /_astro/ hebben een hash in hun naam en veranderen nooit;
# die mag de browser lang bewaren. De pagina's zelf niet.
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/webp "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Eén adres: https, zonder www (zoals de huidige site al doet).
  RewriteCond %{HTTPS} !=on [OR]
  RewriteCond %{HTTP_HOST} ^www\. [NC]
  RewriteRule ^(.*)$ https://buurbrakenhoff.nl/$1 [R=301,L]

  # Oude adressen naar de nieuwe pagina's.
  # Alleen als iemand zelf /index.html opvraagt, niet bij de interne DirectoryIndex.
  RewriteCond %{THE_REQUEST} \s/index\.html[\s?] [NC]
  RewriteRule ^index\.html$ / [R=301,L]
  RewriteRule ^contact\.php$ /contact/ [R=301,L]
  RewriteRule ^over-ons/?$ / [R=301,L]
  RewriteRule ^werkgebieden/?$ /diensten/ [R=301,L]
</IfModule>
