<IfModule mod_rewrite.c>
    RewriteEngine On

    # If the requested file exists directly, serve it
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]

    # If the file exists in /public, serve it from there
    RewriteCond %{DOCUMENT_ROOT}/public%{REQUEST_URI} -f
    RewriteRule ^(.*)$ public/$1 [L]

    # Everything else goes to public/index.php (Laravel front controller)
    RewriteRule ^ public/index.php [L]
</IfModule>
