Htaccess如何mod_deflate以后缀.js?ver = 3.1结尾的javascript文件

时间:2017-01-10 15:26:49

标签: javascript .htaccess google-pagespeed mod-deflate

我使用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>

有什么想法吗?

0 个答案:

没有答案