# ==============================================================
# إعدادات الحماية والتوجيه - نظام قرية الشين (elsheenposts)
# ==============================================================

# منع استعراض محتويات المجلدات
Options -Indexes

# تعيين الترميز الافتراضي utf-8
AddDefaultCharset UTF-8

<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 Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# حماية الملفات الحساسة من التحميل المباشر
<FilesMatch "^(\.env|\.git|\.htaccess|database\.sql|composer\.(json|lock)|package(-lock)?\.json)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>

# تمرير ترويسة Authorization لبيئة PHP (FastCGI / PHP-FPM / CGI)
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>
<IfModule mod_setenvif.c>
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>
