# Apache 配置 - 解决 SPA 路由刷新 404 问题 # 此文件会自动包含在构建的 dist 目录中 RewriteEngine On RewriteBase / # 如果请求的是实际存在的文件或目录,直接返回 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # 否则重定向到 index.html RewriteRule . /index.html [L] # 启用 Gzip 压缩 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json # 设置缓存 ExpiresActive On ExpiresByType text/html "access plus 0 seconds" ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/font-woff2 "access plus 1 year"