# SPA fallback: every unknown path is rendered by index.html and React Router.
Options -MultiViews

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>

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

<IfModule mod_headers.c>
  # The shell must never be cached, or a deploy will not reach returning visitors.
  <FilesMatch "index\.html$">
    Header set Cache-Control "no-cache, must-revalidate"
  </FilesMatch>

  # Vite fingerprints these filenames, so they can be cached for a year.
  <FilesMatch "\.(js|css|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>

  # Product photography keeps plain filenames — 30 days, not immutable.
  <FilesMatch "\.(svg|webp|png|jpg|jpeg|avif)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>

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

