# ===== SchoolSync PHP — Apache Rewrite Rules =====
# Mengarahkan semua request ke front controller (public/index.php)
# Mengaktifkan pretty URL: /api/auth/login, /api/people/siswa, dll.
# SPA fallback juga ditangani oleh index.php.

RewriteEngine On

# Jangan rewrite untuk file/direktori yang benar-benar ada (css, js, gambar)
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Semua request lain → front controller
RewriteRule ^ index.php [L]

# ===== Keamanan: blokir akses langsung ke file sensitif =====
<FilesMatch "^\.|\.(env|sql|md)$">
    Require all denied
</FilesMatch>

# Blokir akses ke folder config, routes, scripts
RewriteRule ^(config|routes|scripts)/ - [F,L]

# ===== Default charset =====
AddDefaultCharset UTF-8

# ===== Kompresi (opsional) =====
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>
