# SPA routing: serve real files/assets directly, otherwise hand the
# request to index.html so TanStack Router can render the route client-side.
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  # Don't rewrite requests for files or directories that actually exist.
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  # Everything else -> index.html (the SPA shell).
  RewriteRule ^ index.html [L]
</IfModule>

# Long-cache fingerprinted assets; never cache the HTML shell.
<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|png|jpe?g|gif|svg|webp|woff2?)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "\.html$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>
