# EduManage SMS — SPA routing for Apache / cPanel
# Place this file in the same directory as index.html (the build output
# you upload to public_html or your subdomain's document root).

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  # Don't rewrite real files/directories (js, css, images, etc.)
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]

  # Everything else goes to index.html so React Router can handle it
  RewriteRule ^ index.html [L]
</IfModule>

# Cache static assets aggressively (CRA fingerprints filenames)
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
</IfModule>

# Never cache index.html so deploys take effect immediately
<Files "index.html">
  <IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
  </IfModule>
</Files>
