# CBT UnHar — Apache security (cPanel)
Options -Indexes
ServerSignature Off

# Lindungi file sensitif
<FilesMatch "^(config\.php|config\.sample\.php|composer\.(json|lock)|schema\.sql)$">
  Require all denied
</FilesMatch>

# Blokir akses langsung ke folder includes, db, lib
RedirectMatch 403 ^/?(includes|db|lib|partials)(/|$)

# Cegah eksekusi PHP di folder uploads
<Directory "uploads">
  php_flag engine off
</Directory>
<FilesMatch "\.(php|phtml|phar)$">
  <If "%{REQUEST_URI} =~ m#/uploads/#">
    Require all denied
  </If>
</FilesMatch>

# Force HTTPS (aktifkan jika sudah punya SSL)
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# Batasi ukuran upload
php_value upload_max_filesize 16M
php_value post_max_size 20M

# Header keamanan (jika mod_headers aktif)
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
