# 缓存控制配置(Apache服务器) # 禁用 HTML 文件的缓存 FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" # 静态资源长期缓存(带hash的文件) Header set Cache-Control "max-age=31536000, public, immutable" # 启用 Gzip 压缩 AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml # SPA 路由支持 RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]