# =========================================================================
# .htaccess معادل web.config قدیمی (IIS) برای هاست cPanel (Apache/LiteSpeed)
# =========================================================================

DirectoryIndex index.php index.html

# ریدایرکت اجباری به HTTPS
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# جلوگیری از لیست‌شدن پوشه‌ها
Options -Indexes

# مخفی‌کردن پوشه‌ها و فایل‌های حساس از دسترسی مستقیم وب
<FilesMatch "^(config\.php|env\.baharestan.*)$">
    Require all denied
</FilesMatch>

<IfModule mod_rewrite.c>
    RewriteRule ^includes/ - [F,L]
    RewriteRule ^cron/ - [F,L]
    RewriteRule ^logs/ - [F,L]
    RewriteRule ^db/ - [F,L]
</IfModule>

# MIME type برای json (معادل تنظیمات web.config)
<IfModule mod_mime.c>
    AddType application/json .json
</IfModule>
