# Disable directory listing
Options -Indexes
# Default directory index
DirectoryIndex index.html
# Serve index.html for SPA client-side routing (if file/dir doesn't exist)
RewriteEngine On
RewriteBase /
# If the request is for an existing file or directory, serve it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Otherwise rewrite to index.html
RewriteRule ^ index.html [L]
# Optional: small caching hints for static assets
ExpiresActive On
ExpiresByType image/* "access plus 1 week"
# No caching for app files — always fetch fresh
Header set Cache-Control "no-store, no-cache, must-revalidate"
Header set Pragma "no-cache"
Header set Cache-Control "max-age=604800, public"
# Prevent serving hidden files (like .env, .git)
Require all denied