<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  
  # 直接返回已存在的文件和目录
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  
  # 排除 API 请求
  RewriteCond %{REQUEST_URI} !^/api/
  
  # 排除常见的静态资源扩展名
  RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|json|xml)$ [NC]
  
  # 将其他请求重写到 index.html
  RewriteRule ^ /index.html [L]
</IfModule>