<IfModule mod_rewrite.c>
    RewriteEngine On

    # Prevent directory listing for security
    Options -Indexes

    # Security: Block direct access to env configuration and internal Laravel folders
    RewriteRule ^\.env$ - [F,L]
    RewriteRule ^(storage|database|resources|tests|app|bootstrap|vendor)($|/) - [F,L]

    # Redirect all incoming requests to the public directory
    RewriteCond %{REQUEST_URI} !^.*/public/
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
