Hey guys,
After running Google Page Speed, my Compression Results were red. Google Page Speed said almost all my files — JS, CS开发者_StackOverflow中文版S, etc. — should be compressed with gzip.I added the following line to my .htaccess file.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css text/plain text/javascript text/xml application/xhtml+xml application/x-httpd-php
</IfModule>
Now the Compression Results look slighly better - yellow! However Page Speed keeps saying that I should compress all my JavaScript libs and plugins. I could reduce them by 65% with gzip.
Shouldn't all my JS files be compressed now when I have text/javascript
set as DEFLATE
?
Apache also uses mime type application/x-javascript, this howto explains how to set it.
Basically it says you need to use:
<Location />
AddOutputFilterByType DEFLATE application/x-javascript
</Location>
On a side note, you might also consider using a minifier/compressor like the YUI compressor or a specific compressor that integrates with your software.
精彩评论