# Apache & LiteSpeed Web Server Configuration
# Aplikasi Uraian Tugas & Indeks Beban Kerja Dispenad

<IfModule mod_rewrite.c>
    RewriteEngine On
    DirectoryIndex index.html index.php

    # Route all /api/* requests to api.php
    RewriteRule ^api/(.*)$ api.php?endpoint=/$1 [QSA,L]
    RewriteRule ^api$ api.php?endpoint=/ [QSA,L]
</IfModule>

<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"

    # Prevent caching for JSON and CSV data files
    <FilesMatch "\.(json|csv)$">
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    </FilesMatch>
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 day"
    ExpiresByType application/javascript "access plus 1 day"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
