<IfModule mod_rewrite.c>
    RewriteEngine On

    # Prevent direct access to sensitive files
    <FilesMatch "^(\.env|\.git|composer\.(json|lock)|package\.(json|lock)|phpunit\.xml)">
        Order allow,deny
        Deny from all
    </FilesMatch>

    # Rewrite all traffic to /public/ folder if not pointing directly to public
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
