Server-side compression on Apache

Server-side compression (Gzip compression in this case) is a simple way to save bandwidth and speed up your website. It is very easy to use and you can do it yourself if you host your site on Apache server and know how to edit files on your FTP server.

All you need to do is add the following code to the top of 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>

Once you modify your .htaccess file, you can verify your compression by going to

http://www.gidnetwork.com/tools/gzip-test.php

Be the first to comment

Leave a Reply

Your email address will not be published.


*