Date post: | 22-Apr-2015 |
Category: |
Technology |
Upload: | godaddy |
View: | 206 times |
Download: | 3 times |
How To Make Your Website Faster
Episode 4) Compress, Combine and Minify
Replace with new
graphics
Compress (Content-Encoding: gzip)
No consJust turn it onWebserver level - not app
Next slides are how-to● cPanel● Plesk
● Managed Wordpress
● Manual
cPanel compression
Managed WordPress Compression
Plesk compression
o Just in case:
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
must go inside <system.webServer> ... </system.webServer>in your /httpdocs/web.config file
Generic: Apache
To turn on text compressionAdd the following to your .htaccess file:
<ifModule mod_gzip.c>mod_gzip_on Yesmod_gzip_dechunk Yesmod_gzip_item_include file .(html?|txt|css|js|php|pl)$mod_gzip_item_include handler ^cgi-script$mod_gzip_item_include mime ^text/.*mod_gzip_item_include mime ^application/x-javascript.*mod_gzip_item_exclude mime ^image/.*mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*</ifModule>
Generic: Apache
If that doesn’t work … try these:
AddOutputFilterByType DEFLATE text/plainAddOutputFilterByType DEFLATE text/htmlAddOutputFilterByType DEFLATE text/xmlAddOutputFilterByType DEFLATE text/cssAddOutputFilterByType DEFLATE application/xmlAddOutputFilterByType DEFLATE application/xhtml+xmlAddOutputFilterByType DEFLATE application/rss+xmlAddOutputFilterByType DEFLATE application/javascriptAddOutputFilterByType DEFLATE application/x-javascript
Generic: NGINX
Add the following to your config file:
gzip on;gzip_comp_level 2;gzip_http_version 1.0;gzip_proxied any;gzip_min_length 1100;gzip_buffers 16 8k;gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problemsgzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6gzip_vary on;
Generic: IISIIS6
IIS7
See also: http://technet.microsoft.com/en-us/library/cc782942.aspx (IIS6) and http://technet.microsoft.com/en-us/library/cc753681.aspx (IIS7)
Combine/minify w/ WP-Minify-Fixedhttp://wordpress.org/plugins/wp-minify-fixed/
270KB reduced to 90KBAnd fewer round trips == faster web page
Demo
Athletesbrand.com
WPT results for hostingperformance.guru
Combine/Minify Manuallyhttps://code.google.com/p/minify/
Is part of ● WordPress: WP-Minify
● WordPress: W3 Total Cache
● Zend Framework: View helpers for links/scripts
● Yii: minscript Extension
Use online tools to minify JS and CSS
Always use the .min.js and .min.css versions