Speed up your website with gzip compression

* Note: This article only applies to Linux hosting. On IIS, compression is normally enabled on server level. *

Does your website appear to be loading slow? Speed it up using gzip compress and mod_deflate. You can first verify if your site is already serving compressed content from this link. If it isn’t, add the following code in the .htaccess file under your website folder, save it and then check again for compression. Your site should be loading pages significantly faster now!


### Enable gzip compression for PHP files
php_value output_handler ob_gzhandler

### 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

### End of compression code

Did you find this article useful?