# .htaccess للـ API
# تحسين الأداء والأمان

# تفعيل Rewrite Engine
RewriteEngine On

# السماح بـ CORS من أي مصدر (للتطوير)
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"

# تفعيل الضغط
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>

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

# حماية الملفات الحساسة
<FilesMatch "\.(htaccess|htpasswd|ini|log|sql)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# تفعيل PHP Error Reporting للتطوير
php_flag display_errors On
php_value error_reporting E_ALL

# رفع حد الذاكرة
php_value memory_limit 256M
php_value upload_max_filesize 20M
php_value post_max_size 20M

# Timeout settings
php_value max_execution_time 300
php_value max_input_time 300

# UTF-8 Encoding
AddDefaultCharset UTF-8

