# Hostinger / Apache config

DirectoryIndex index.html

<IfModule mod_rewrite.c>
  RewriteEngine On
  # Force HTTPS (Hostinger issues a free certificate; use it)
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

# Never cache API responses or the service worker
<FilesMatch "\.(php)$">
  Header set Cache-Control "no-store"
</FilesMatch>
<Files "sw.js">
  Header set Cache-Control "no-cache"
</Files>

# Static assets can cache hard
<FilesMatch "\.(png|svg|webp|woff2)$">
  Header set Cache-Control "public, max-age=2592000"
</FilesMatch>

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