<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  
  # حماية ملفات النظام
  RewriteRule ^(\.git|\.env|composer\.json|composer\.lock) - [F,L]
  
  # توجيه جميع الطلبات إلى index.php إذا لم يكن الملف موجوداً
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

# منع الوصول المباشر لملفات PHP محددة
<FilesMatch "^(config|database)\.php$">
  Deny from all
</FilesMatch>