# Apache configuration for Single Page Application (SPA)
# This file ensures all routes are passed to the Node.js backend

# Enable rewrite engine
RewriteEngine On

# Don't rewrite files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Don't rewrite API routes - let them pass through to Node.js
RewriteCond %{REQUEST_URI} !^/api/

# Rewrite everything else to index.html for client-side routing
RewriteRule ^ index.html [L]

# Security headers (optional but recommended)
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
</IfModule>
