<IfModule mod_rewrite.c>
    RewriteEngine On

    # If the request already points to /public, keep it as-is.
    RewriteRule ^public/ - [L]

    # Serve existing files/directories in the project root directly.
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Send everything else to /public.
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
