<IfModule mod_rewrite.c>
    RewriteEngine On

    # Handle Authorization Header for JWT Bearer Tokens
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # If the requested file or directory exists in public/, serve it directly
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    # Otherwise, forward all requests to index.php
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
