<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # توجيه كل الطلبات غير الموجودة إلى index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index\.php$ [NC] # Exclude index.php
    RewriteRule ^ index.php [L]

    RewriteRule ^vendor/(.*)?$ / [F,L]

    RewriteRule ^composer\.(lock|json)$ / [F,L]

    <Files .env>
        Order allow,deny
        Deny from all
    </Files>

    RedirectMatch 404 /\.git

    <FilesMatch "\.(env|bak|backup|sql|swp|log|htpasswd)$">
        Order allow,deny
        Deny from all
    </FilesMatch>

    <FilesMatch "^(artisan|composer\.json|composer\.lock|package\.json|webpack\.mix\.js|vite\.config\.js)$">
        Order allow,deny
        Deny from all
    </FilesMatch>


</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
</IfModule>

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>

<IfModule lsapi_module>
    php_flag display_errors Off
    php_value max_execution_time 30
    php_value max_input_time 60
    php_value max_input_vars 1000
    php_value memory_limit 512M
    php_value post_max_size 1024M
    php_value session.gc_maxlifetime 1440
    php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
    php_value upload_max_filesize 2048M
    php_flag zlib.output_compression On
</IfModule>
