# Bloquer l'accès direct à config.php et clients.json
<FilesMatch "^(config\.php|settings\.php|clients\.json|\.update_cache\.json|\.update_fail\.json|theme\.json|version\.json\.exemple)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Bloquer l'accès au dossier des sauvegardes
RedirectMatch 403 ^/.*/backups/.*$

# Activer le moteur de réécriture
Options -Indexes

# Forcer HTTPS (redirige tout le trafic HTTP vers HTTPS)
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

# Interdire l'indexation par les moteurs de recherche
<IfModule mod_headers.c>
    Header set X-Robots-Tag "noindex, nofollow, noarchive, nosnippet"
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    # HSTS : force HTTPS pendant 1 an (à activer une fois le HTTPS confirmé)
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
</IfModule>

# Fichier robots.txt virtuel
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^robots\.txt$ - [L]
</IfModule>
