我使用mod_deflate加速我的网站。我有一个不会缩小的JavaScript文件(我相信因为它结束.js?ver=3.1
而不是.js
)。以下是我的.htaccess
代码:
<IfModule mod_deflate.c>
AddOutputFilter DEFLATE js css
<filesMatch "\.(js)$">
SetOutputFilter DEFLATE
</filesMatch>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
<FilesMatch ".(xml|txt|css|js)$">
Header set Cache-Control "max-age=904800, proxy-revalidate"
</FilesMatch>
</IfModule>
有什么想法吗?