# Plesk / Apache config for a static React SPA build
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Serve existing files and directories as-is
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Everything else falls back to index.html (client-side routing)
  RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_mime.c>
  AddType image/webp .webp
  AddType image/avif .avif
  AddType font/woff2 .woff2
</IfModule>

# Long cache for fingerprinted build assets
<IfModule mod_expires.c>
  ExpiresActive On
  <FilesMatch "\.(js|css|woff2|jpg|jpeg|png|webp|avif|svg)$">
    ExpiresDefault "access plus 1 year"
  </FilesMatch>
  <FilesMatch "\.(html)$">
    ExpiresDefault "access plus 0 seconds"
  </FilesMatch>
</IfModule>

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