<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Block direct access
    RewriteRule ^uploads/.*\.php$ - [F,L]
    RewriteRule ^data/ - [F,L]

    # Skip real files/dirs
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Pretty URL routing → index.php
    RewriteRule ^kategori/([a-zA-Z0-9_-]+)/?$ index.php?route=kategori&slug=$1 [QSA,L]
    RewriteRule ^bukti/([a-zA-Z0-9_-]+)/?$ index.php?route=bukti&slug=$1 [QSA,L]
    RewriteRule ^artikel/([a-zA-Z0-9_-]+)/?$ index.php?route=artikel&slug=$1 [QSA,L]
    RewriteRule ^tentang/?$ index.php?route=tentang [QSA,L]
    RewriteRule ^sitemap\.xml$ index.php?route=sitemap [L]
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
</IfModule>
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/webp "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
</IfModule>
