# ===== Sabisa Learning System - pengaturan Apache/LiteSpeed (Rumahweb) =====
DirectoryIndex index.html
Options -Indexes
ServerSignature Off

# --- Paksa HTTPS: hapus tanda # di 3 baris berikut SETELAH SSL (AutoSSL) aktif di cPanel ---
#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# --- Aplikasi bisa dipasang (PWA) ---
<IfModule mod_mime.c>
  AddType application/manifest+json .webmanifest
</IfModule>

# --- Kompresi (halaman jadi jauh lebih ringan) ---
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/manifest+json text/html text/css application/javascript text/javascript application/json image/svg+xml text/plain
</IfModule>

# --- Cache: file di /assets memakai nama berhash, aman disimpan 1 tahun ---
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/javascript "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>
<IfModule mod_headers.c>
  <FilesMatch "\.(css|js|png|webp|svg|ico)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "\.html$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
  <FilesMatch "^(sw\.js|manifest\.webmanifest)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
   Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https://accounts.google.com/gsi/client; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://accounts.google.com/gsi/style; font-src https://fonts.gstatic.com; img-src 'self' data: blob: https://*.googleusercontent.com https://drive.google.com https://*.gstatic.com; frame-src 'self' https://accounts.google.com/gsi/ https://drive.google.com https://docs.google.com https://*.googleusercontent.com https://*.google.com; connect-src 'self' https://accounts.google.com/gsi/; base-uri 'self'; form-action 'self'; frame-ancestors 'self'"
</IfModule>

# --- Sembunyikan file sensitif ---
<FilesMatch "^\.|\.(sql|md|log|bak|sqlite)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
  </IfModule>
</FilesMatch>
