# Touch Therapies Antigua — SPA routing + caching (Apache / cPanel)
# This file ships with the built frontend (dist/) — upload it with the site.

RewriteEngine On
RewriteBase /

# Never rewrite the API or uploads (handled by the backend)
RewriteRule ^(api|admin|uploads)/ - [L]

# Serve real files directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Everything else → the React app
RewriteRule ^ index.html [L]

# Browser caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>

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