<IfModule mod_rewrite.c>
    RewriteEngine On

    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>



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

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


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

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]

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

      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_rewrite.c>
    RewriteEngine On

    RewriteRule ^(app|storage|config|routes|database|bootstrap|tests|node_modules|vendor)/ - [F,L]
    
    RewriteRule ^(\.env|\.env.example|\.git|\.gitignore|composer\.(json|lock)|package\.(json|lock))$ - [F,L]

</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/uploads/
    RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|webp|svg|ico)$ [NC]
    RewriteRule ^uploads/ - [F,L]
</IfModule>
<Files .env>
    order allow,deny
    Deny from all
</Files>

<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>

<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>

# <IfModule mod_rewrite.c>
#     RewriteEngine On

#     RewriteCond %{HTTPS} off
#     RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]

#     RewriteCond %{HTTP_HOST} !^www\. [NC]
#     RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]

#     RewriteCond %{THE_REQUEST} \s/index\.php [NC]
#     RewriteRule ^index\.php(.*)$ /$1 [L,R=301]

#     RewriteCond %{REQUEST_FILENAME} !-d
#     RewriteCond %{REQUEST_FILENAME} !-f
#     RewriteRule ^ index.php [L]
# </IfModule>

