# SPA fallback: serve index.html for client-side routes BUT do NOT
# intercept the /api/ folder (that has its own .htaccess).
# Site is deployed at the document root of prmtly.com, so RewriteBase
# is "/". If you ever move the install under a sub-path (e.g.
# /nadiplayer/), change BOTH this RewriteBase and api/.htaccess too.
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Never rewrite /api/* — let api/.htaccess take over.
  RewriteRule ^api/ - [L]
  RewriteRule ^api$ - [L]

  # Real files / dirs are served directly.
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Everything else → SPA index.html.
  RewriteRule ^ index.html [L]
</IfModule>

# Make sure SPA assets are cacheable, but index.html is not (so updates roll out).
<IfModule mod_headers.c>
  <FilesMatch "^index\.html$">
    Header always set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
  </FilesMatch>
</IfModule>
