January 19, 2010 by Thibault D
This snippet will only work with apache2 servers.
Bandwidth has a cost, and performances matters.
But we can go even farther.
You can enable gzip compression for javacript and stylesheet files. It reduces their weight by three to four times.
Now, we will tell apache to forward requests to a .css or .js to the gzipped file, if any.
web/.htaccess, uncomment the lines between
# SEND GZIPPED CONTENT TO COMPATIBLE BROWSERS
# END GZIPPED CONTENT
You should now have:
Open a page of your website and inspect requests with firebug. The server now sends gzipped assets, and load time is reduced.
This tip will not work on all servers, depending on apache configuration.