# ─────────────────────────────────────────────────────────────────────────────
# SPA .htaccess for udyogo-sales.demosystem.in (lives in public/, so Vite copies
# it into dist/ on build). Upload the contents of dist/ to the subdomain's
# document root (e.g. public_html or .../udyogo-sales.demosystem.in).
# ─────────────────────────────────────────────────────────────────────────────
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Force HTTPS (optional — remove if the host already redirects).
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

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

# Long-cache the fingerprinted assets, never cache index.html.
<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|woff2?|png|jpe?g|svg|gif|ico)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>
    <FilesMatch "index\.html$">
        Header set Cache-Control "no-cache, no-store, must-revalidate"
    </FilesMatch>
</IfModule>
