Jan 6, 2009 18
More on compressing and caching your site with .htaccess
“.htaccess - gzip and cache your site for faster loading and bandwidth saving” is one of the most popular posts on samaxes.
It’s basically on how to compress and cache your site content with Apache and .htaccess file.
It works like a charm, but it’s not yet the perfect configuration for me.
I wanted something that I can use out-of-the-box without having to rely on external extension modules or tools.
If you are lucky enough to have Apache 2 with your hosting provider you can use the mod_deflate module that comes bundled with it.
In order to compress your text files with this Apache’s module you just have to add the following lines to your .htaccess file:
<IfModule mod_deflate.c> <FilesMatch "\.(css|js|x?html?|php)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> |
This will gzip all your *.css, *.js, *.html, *.html, *.xhtml, and *.php files.
Read the rest of this entry »