# PHP Dosyalarının Doğru MIME Türüyle İşlenmesini Garanti Et
<IfModule mod_mime.c>
    AddType application/x-httpd-php .php
</IfModule>

# LiteSpeed Cache Modülünü Tamamen Devre Dışı Bırak
<IfModule LiteSpeed>
    CacheLookup off
</IfModule>

# PHP Dosyaları İçin Doğru Content-Type ve Önbellek Kontrolü
<IfModule mod_headers.c>
    <FilesMatch "\.php$">
        Header set Content-Type "text/html; charset=utf-8"
        Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
        Header set Pragma "no-cache"
        Header set X-LiteSpeed-Cache-Control "no-cache"
    </FilesMatch>
</IfModule>

# Options +FollowSymLinks -MultiViews

<IfModule mod_rewrite.c>
RewriteEngine On

# Eğer proje bir alt klasördeyse (örneğin localhost/youtubedonusturucu), 
# burayı /youtubedonusturucu/ şeklinde değiştirebilirsiniz. 
# Ana dizinde ise / olarak kalması yeterlidir.
RewriteBase /

# LiteSpeed Cache Bypass (Her istek için önbelleği atla)
RewriteRule .* - [E=Cache-Control:no-cache]

# Robots.txt ve Sitemap.xml Yönlendirmeleri
RewriteRule ^robots.txt$ robots.php [L]
RewriteRule ^sitemap.xml$ sitemap.php [L]

# Trailing slash (sondaki eğik çizgi) temizleme
# /$1 yerine $1 kullanıldı, böylece alt klasörlerde ana dizine atma hatası (404) önlendi.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [L,R=301]

# Özel Temiz URL Yönlendirmeleri
RewriteRule ^admin/?$ admin.php [L,QSA]
RewriteRule ^iletisim/?$ iletisim.php [L,QSA]

# Uzantısız PHP Dosya Yönlendirmesi (Nokta kaçış karakteriyle korundu)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^.]+)$ $1.php [NC,L]
</IfModule>
