Options -Indexes

<FilesMatch "\.(env|sql|log|sh|md|sample|gitkeep)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # PHP backend — exécuter directement
    RewriteRule ^barka-sap-backend/.*\.php$ - [L]

    # Fichiers statiques existants
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # SPA — tout le reste vers index.html
    RewriteRule ^ index.html [L]
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css               "access plus 7 days"
    ExpiresByType application/javascript "access plus 7 days"
    ExpiresByType image/png              "access plus 30 days"
    ExpiresByType image/jpeg             "access plus 30 days"
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>
