# ============================================================
# PT. ARTA BOGA INDONESIA - Rating System
# Apache Configuration
# ============================================================

# Aktifkan Rewrite Engine
RewriteEngine On

# Keamanan: Blokir akses langsung ke folder API (hanya via index.php)
# Tidak diblokir karena API memang harus diakses langsung oleh fetch()

# Blokir akses ke file sensitif
<FilesMatch "^(config\.php|database\.sql)$">
    Order deny,allow
    Deny from all
</FilesMatch>

# Blokir akses ke hidden files
<FilesMatch "^\.">
    Order deny,allow
    Deny from all
</FilesMatch>

# Security Headers
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "DENY"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Permissions-Policy "camera=(), microphone=(), geolocation=()"
</IfModule>

# PHP Settings
<IfModule mod_php.c>
    php_value session.cookie_httponly 1
    php_value session.use_strict_mode 1
    php_value upload_max_filesize 2M
    php_value post_max_size 2M
</IfModule>

# Default Document
DirectoryIndex index.php

# Cache static assets
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>

# Gzip Compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>
