Options -Indexes
Options -MultiViews

# Säkerhet – blockera direkt åtkomst till känsliga filer
<FilesMatch "(config\.php|_auth\.php|\.sqlite|\.log)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Blockera direkt webbåtkomst till workers och database
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Blockera workers/ och database/ från webben
    RewriteRule ^workers/   - [F,L]
    RewriteRule ^database/  - [F,L]
    RewriteRule ^cache/     - [F,L]
    RewriteRule ^confignew/ - [F,L]
    RewriteRule ^install/   - [F,L]
    RewriteRule ^install\.php$ - [F,L]
    RewriteRule ^README\.md$ - [F,L]
    RewriteRule \.php\..*$ - [F,L]
    RewriteRule \.(bak|backup|old)(\.|$) - [F,L]

    # Valfritt: rena URL:er (t.ex. /radio/p1 → index.php?slug=p1)
    # RewriteCond %{REQUEST_FILENAME} !-f
    # RewriteCond %{REQUEST_FILENAME} !-d
    # RewriteRule ^([a-z0-9-]+)/?$ index.php?slug=$1 [L,QSA]
</IfModule>

# Cacha statiska filer
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/png  "access plus 7 days"
    ExpiresByType image/jpeg "access plus 7 days"
    ExpiresByType text/css   "access plus 1 day"
    ExpiresByType application/javascript "access plus 1 day"
</IfModule>

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

# Säkerhetsheaders
<IfModule mod_headers.c>
    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"
</IfModule>

# Android APK download
AddType application/vnd.android.package-archive .apk
<FilesMatch "\.apk$">

</FilesMatch>
