# cPanel / Apache SPA routing — serve index.html for any client-side route
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Don't rewrite real files / directories
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Everything else → index.html (React Router handles the path)
    RewriteRule . /index.html [L]
</IfModule>

# Cache static assets aggressively (hashed filenames invalidate themselves)
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css                   "access plus 1 year"
    ExpiresByType application/javascript     "access plus 1 year"
    ExpiresByType image/svg+xml              "access plus 1 month"
    ExpiresByType image/png                  "access plus 1 month"
    ExpiresByType image/jpeg                 "access plus 1 month"
    ExpiresByType font/woff2                 "access plus 1 year"
    ExpiresByType text/html                  "access plus 0 seconds"
</IfModule>

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

# Security
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
