# Admin dizini için güvenlik ayarları
Options -Indexes
AllowOverride All

# PHP dosyalarına erişim
<FilesMatch "\.php$">
    Require all granted
</FilesMatch>

# Hassas dosyalara erişimi engelle
<FilesMatch "^(\.htaccess|\.htpasswd|\.git|\.env|config\.php|baglan\.php)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Güvenlik başlıkları
<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 Content-Security-Policy "default-src 'self' https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https:; style-src 'self' 'unsafe-inline' https:; img-src 'self' data: https:; font-src 'self' data: https:; connect-src 'self' https:; frame-src 'self' https:;"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Permissions-Policy "geolocation=(), microphone=(), camera=()"
</IfModule>

# URL yönlendirme kuralları
#<IfModule mod_rewrite.c>
    #RewriteEngine On
    
    # login URL'sini daxil-ol.php'ye yönlendir
    #RewriteRule ^login/?$ daxil-ol.php [L]
    
    # PHP dosyalarına doğrudan erişime izin ver
    #RewriteCond %{REQUEST_FILENAME} -f
    #RewriteRule ^ - [L]
    
    # Diğer tüm istekleri daxil-ol.php'ye yönlendir
    #RewriteRule ^(.*)$ daxil-ol.php [L]
#</IfModule>

# PHP hata gösterimini kapat
php_flag display_errors off

# Dizin listelemeyi kapat
Options -Indexes

# Varsayılan karakter seti
AddDefaultCharset UTF-8

# Sıkıştırma
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

# Önbellek kontrolü
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
</IfModule>

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^g2aleri/? galeri2.php [NC,L]

RewriteRule ^([0-9a-zA-Z-_]+)$  detals.php?seo=$1 [L,QSA]

