# Static site (Astro build). LiteSpeed/Apache shared hosting.

# Friendly 404 instead of the host's default page
ErrorDocument 404 /404.html

# Serve /about as /about/index.html and drop the trailing-slash redirect noise
DirectoryIndex index.html
Options -Indexes

# The owner checklist travels as a .md file next to the pages. It is meant for the
# owner, so it must not answer to a visitor's URL if it is left on the server.
<IfModule mod_authz_core.c>
  <FilesMatch "\.md$">
    Require all denied
  </FilesMatch>
</IfModule>

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

<IfModule mod_expires.c>
  ExpiresActive On
  # Hashed assets can be cached hard
  <FilesMatch "\.(woff2|woff|ttf|otf|jpg|jpeg|png|webp|avif|svg|ico)$">
    ExpiresDefault "access plus 1 year"
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "\.(css|js)$">
    ExpiresDefault "access plus 1 year"
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  # HTML must stay fresh
  <FilesMatch "\.html$">
    ExpiresDefault "access plus 0 seconds"
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>
</IfModule>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
