# ===== Palace Cup 2026 — Apache / cPanel config =====

# --- SPA fallback: serve index.html for client-side routes ---
<IfModule mod_rewrite.c>
  RewriteEngine On
  # If the requested file or folder exists, serve it as-is...
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  # ...otherwise hand the request to the Angular app.
  RewriteRule ^ index.html [L]
</IfModule>

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

# --- Caching: hashed assets forever, html never ---
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/jpeg "access plus 6 months"
  ExpiresByType image/png "access plus 6 months"
  ExpiresByType image/webp "access plus 6 months"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>

<IfModule mod_headers.c>
  <FilesMatch "\.(?:js|css|jpg|jpeg|png|webp|avif|gif|ico|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "\.html$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
</IfModule>
