# Laravel cPanel Root .htaccess
# Use this if installing in a subdirectory or if public folder is not the web root

<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Redirect to public folder if accessing root
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Prevent access to sensitive files
<FilesMatch "^\.">
    Order allow,deny
    Deny from all
</FilesMatch>

# Prevent access to .env file
<Files .env>
    Order allow,deny
    Deny from all
</Files>

