# ============================================================
#  PIA School — .htaccess (racine public_html/piaschool/)
# ============================================================

Options -Indexes

# Forcer HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Bloquer l'accès direct aux fichiers PHP de l'API
# (ils doivent être appelés via fetch depuis index.html)
<FilesMatch "^config\.php$">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# Headers de sécurité
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "DENY"
  Header always set X-XSS-Protection "1; mode=block"
</IfModule>

# Cache des assets statiques
<FilesMatch "\.(css|js|png|jpg|gif|ico|woff2)$">
  Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
