Options -Indexes -MultiViews
ServerSignature Off

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# فایل/پوشه واقعی را مستقیم serve کن
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# API
RewriteRule ^api$       api/index.php   [QSA,L]
RewriteRule ^api/(.+)$  api/index.php   [QSA,L]

# Bot webhook
RewriteRule ^bot$       bot/index.php   [QSA,L]
RewriteRule ^bot/(.+)$  bot/index.php   [QSA,L]

# Install - فقط index را route کن، installer.php مستقیم serve میشه
RewriteRule ^install/?$         install/index.php       [QSA,L]
RewriteRule ^install/index$     install/index.php       [QSA,L]
RewriteRule ^install/installer$ install/installer.php   [QSA,L]

# Panel
RewriteRule ^panel/?$     panel/index.php   [QSA,L]
RewriteRule ^panel/(.+)$  panel/index.php   [QSA,L]

# Root
RewriteRule ^$ index.php [QSA,L]
</IfModule>

# امنیت
<FilesMatch "\.(json|log|bak|sh|env|lock|sql|ini)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
    </IfModule>
</FilesMatch>

# PHP - غیرفعال کردن نمایش خطا در خروجی
<IfModule mod_php7.c>
    php_flag  display_errors        Off
    php_flag  display_startup_errors Off
    php_value memory_limit          128M
    php_value max_execution_time    60
    php_value upload_max_filesize   10M
    php_value post_max_size         10M
</IfModule>
<IfModule mod_php8.c>
    php_flag  display_errors        Off
    php_flag  display_startup_errors Off
    php_value memory_limit          128M
    php_value max_execution_time    60
    php_value upload_max_filesize   10M
    php_value post_max_size         10M
</IfModule>
