RewriteEngine On RewriteBase /agw/ # Let the backend reverse proxy handle /agw/api/ RewriteRule ^api(/|$) - [L] # If the requested file or directory exists, serve it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise, rewrite to index.html for SPA routing RewriteRule ^ index.html [L]