How to Optimize your Website with gzip Compression

So you might run across this when you are trying to optimize your website or the page speed is really slow and you’re thinking your head, what the fuck !?  You minified your css, your javascript and you feel a little stuck.  On Apache, you will add the following to your .htaccess file:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>

Sorry I don’t have the Windows version yet but you can find it on Google (like almost everything).  The gzip compression will reduce the traffic between web server and your browsers, they claim you reduce the speed of up to 70% but it really depends on the internet speed and how much you optimize your other files and images located on your server.   If you are using php, remember to change the extension type.

If you want to learn more about how to optimize your website, check out the Google webmasters  for more info.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.