RewriteEngine On
RewriteBase /

# Existing files/directories are served normally.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Never swallow API/upload endpoints that may live under real folders.
RewriteCond %{REQUEST_URI} !^/api(?:/|$) [NC]
RewriteRule ^ index.html [L,QSA]
