Options -Indexes -MultiViews
DirectoryIndex index.html

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Avoid Apache's directory-slash redirect for /api so POST bodies are preserved.
  RewriteRule ^api/?$ api/index.php [QSA,L]

  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Missing hashed build assets must remain 404 responses. Rewriting them to
  # index.html returns text/html to a module request and hides stale deployments.
  RewriteRule ^assets/ - [R=404,L]

  RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header append Vary "Accept-Encoding"

  <FilesMatch "\.(js|css|png|jpg|jpeg|gif|svg|webp|woff|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>

  <Files "index.html">
    Header set Cache-Control "no-cache, no-store, must-revalidate"
  </Files>
</IfModule>

<IfModule mod_brotli.c>
  AddOutputFilterByType BROTLI_COMPRESS text/plain text/html text/css text/javascript application/javascript application/json image/svg+xml
</IfModule>

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

<FilesMatch "^\.">
  Require all denied
</FilesMatch>
