# MetinPaylaş Güvenlik Ayarları

# PHP hata gösterimini kapat (canlı ortamda)
# php_flag display_errors off

# Dizin listelemeyi kapat
Options -Indexes

# XSS koruması
<IfModule mod_headers.c>
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options "nosniff"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set Content-Security-Policy "default-src 'self' https://cdn.jsdelivr.net https://api.qrserver.com https://fonts.googleapis.com https://fonts.gstatic.com https://maxcdn.bootstrapcdn.com https://cdn.ckeditor.com; script-src 'self' https://cdn.jsdelivr.net https://cdn.ckeditor.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' https://cdn.jsdelivr.net https://fonts.googleapis.com https://fonts.gstatic.com https://maxcdn.bootstrapcdn.com https://cdn.ckeditor.com 'unsafe-inline'; img-src 'self' https://api.qrserver.com https://cdn.ckeditor.com data: *; font-src 'self' https://fonts.gstatic.com https://cdn.jsdelivr.net data:;"
</IfModule>

# HTTPS yönlendirmesi (SSL sertifikanız varsa açın)
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# PHP dosyalarına doğrudan erişimi engelle (includes klasörü)
<FilesMatch "^(config|functions)\.php$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</FilesMatch>

# Rate limiting (çok fazla istek engelleme)
# Bu özellik için mod_ratelimit veya benzer bir modül gereklidir
# <IfModule mod_ratelimit.c>
#     SetOutputFilter RATE_LIMIT
#     SetEnv rate-limit 5
# </IfModule>

# Dosya yükleme limitini ayarla (5MB)
<IfModule mod_php.c>
    php_value upload_max_filesize 5M
    php_value post_max_size 6M
    php_value max_execution_time 60
    php_value max_input_time 60
</IfModule>

# UTF-8 karakter kodlaması
AddDefaultCharset UTF-8

# Gzip sıkıştırma
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/x-javascript
</IfModule>

# Tarayıcı önbelleği
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 1 week"
</IfModule>
