# =============================================================================
# AI Admin Portal SPA — Apache fallback for client-side routing
# =============================================================================
# Same purpose as the NOC frontend's .htaccess: makes deep links
# (e.g. /ai/tickets/42) work after a page refresh by falling back to
# /ai/index.html for any path that doesn't map to a real file.
# =============================================================================

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ai/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>
    <FilesMatch "\.html$">
        Header set Cache-Control "no-cache, no-store, must-revalidate"
    </FilesMatch>
</IfModule>
