![gzip 特定文件](https://linux22.com/image/596338/gzip%20%E7%89%B9%E5%AE%9A%E6%96%87%E4%BB%B6.png)
由于某种原因,这些文件无法在我的 apache 服务器上进行 gzip 压缩,chrome 网络选项卡显示了这一点。我是否可以向 htaccess 添加特定指令来缓存这些文件?
Compressing the following resources with gzip could reduce their transfer size by about two thirds (~680.45KB):
adae8bc4c3cb52cbe22358aaced87a72.css could save ~607B
css_f91fa8d73b5e7661d6dcf9e58395e533.css could save ~59.54KB
jquery.min.js could save ~37.27KB
drupal.js could save ~6.15KB
auto_image_handling.js could save ~6.72KB
lightbox.js could save ~29.38KB
superfish.js could save ~2.42KB
jquery.bgiframe.min.js could save ~1011B
jquery.hoverIntent.minified.js could save ~1.05KB
nice_menus.js could save ~581B
panels.js could save ~531B
jquery.pngFix.js could save ~2.98KB
jquery.cycle.all.min.js could save ~20.20KB
views_slideshow.js could save ~8.76KB
views_slideshow.js could save ~9.02KB
wanderlust_custom_videos.js could save ~598B
wl_helper.js could save ~777B
extlink.js could save ~2.88KB
cufon-yui.js could save ~11.89KB
googleanalytics.js could save ~1.48KB
swfobject.js could save ~6.65KB
jquery.jcarousel.min.js could save ~10.19KB
jcarousel.js could save ~6.01KB
Akzidenz_Grotesk_BE_Super_800.font.js could save ~14.27KB
Akzidenz_Grotesk_BE_Bold_700.font.js could save ~12.96KB
Akzidenz_Grotesk_BE_Cn_400.font.js could save ~13.39KB
SuperCondensed_500.font.js could save ~24.40KB
FuturaBold_700.font.js could save ~26.19KB
Futura_500.font.js could save ~57.70KB
SuperGroteskB_500.font.js could save ~23.86KB
jquery.cookie.js could save ~1.25KB
wanderlust.js could save ~1.69KB
sliderbottom.js could save ~442B
jcarousellite_1.0.1.min.js could save ~4.60KB
jcarousellite_control.js could save ~224B
sitesdropdown.js could save ~1.09KB
widgets.js could save ~50.13KB
cufon-drupal.js could save ~599B
swfobject_api.js could save ~348B
ga.js could save ~24.02KB
all.js could save ~124.67KB
tweet_button.1347008535.html could save ~38.43KB
xd_arbiter.php could save ~16.80KB
xd_arbiter.php could save ~16.80KB
答案1
你可能想看看 mod_deflate:http://httpd.apache.org/docs/2.2/mod/mod_deflate.html
答案2
既然您关心 gzip,我猜您主要关心的是性能。理想情况下,.htaccess
应该在 中启用指令,httpd.conf
但如果您像我一样使用共享主机,那么您只能使用.htaccess
。
我问了一个此处可能相关的问题。
如果mod_deflate
可以启用,则该问题中的代码(以及我在评论中链接到的 repo)将在JS
和上启用它CSS
。
也就是说,单独JS
文件的数量太惊人了,如果可能的话,您应该将它们合并为尽可能少的文件。