# RetroMuz — Apache yapılandırması
# Tüm istekler index.php'ye yönlenir; gerçek dosyalar doğrudan sunulur.

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Var olan dosya veya klasörse dokunma
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Geri kalan her şey ön denetleyiciye
    RewriteRule ^ index.php [L]
</IfModule>

# Dizin listelemesi kapalı
Options -Indexes

DirectoryIndex index.php

# setifempty kullanılıyor, set değil: PHP bazı rotalarda kendi değerini
# gönderiyor (örn. dış bağlantıya yönlendirirken Referrer-Policy: no-referrer).
# "set" bunları sessizce eziyordu.
<IfModule mod_headers.c>
    Header setifempty X-Content-Type-Options "nosniff"
    Header setifempty X-Frame-Options "SAMEORIGIN"
    Header setifempty Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Statik dosyalar uzun süre önbelleklensin (adresler ?v= damgası taşır)
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css                "access plus 1 year"
    ExpiresByType application/javascript  "access plus 1 year"
    ExpiresByType image/png               "access plus 1 year"
    ExpiresByType image/jpeg              "access plus 1 year"
    ExpiresByType image/gif               "access plus 1 year"
    ExpiresByType image/webp              "access plus 1 year"
    ExpiresByType image/svg+xml           "access plus 1 year"
    ExpiresByType font/woff2              "access plus 1 year"
</IfModule>

# AddOutputFilterByType mod_filter'ın komutudur, mod_deflate'in değil.
# Yanlış modüle bakan bir koşul, modül kapalıyken her isteği 500'e düşürür.
<IfModule mod_filter.c>
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml \
        application/javascript application/json application/xml image/svg+xml
</IfModule>
</IfModule>
