RewriteEngine On

# If the request is for a real directory or file, serve it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise, route everything to the API entry point
RewriteRule ^(.*)$ api/index.php [QSA,L]
