RewriteEngine On

# assets/style.css gibi statik dosyalar direkt sunulsun (rewrite'a takılmasın)
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# Geri kalan HER istek index.php'ye gider (front controller pattern).
# index.php içindeki $path ayrıştırması /haber/slug, /sitemap.xml vb. yönlendirir.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

# Güvenlik: config, includes klasörlerine doğrudan HTTP erişimini kapat
<IfModule mod_alias.c>
    RedirectMatch 403 ^/config/
    RedirectMatch 403 ^/includes/
    RedirectMatch 403 ^/database/
    RedirectMatch 403 ^/cache/
</IfModule>

# Hafif performans: statik varlıklarda tarayıcı cache'i
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 30 days"
    ExpiresByType image/jpeg "access plus 30 days"
    ExpiresByType image/png "access plus 30 days"
</IfModule>

# Gzip sıkıştırma (CPU maliyeti düşük, bant genişliği kazancı yüksek)
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/xml text/xml
</IfModule>
