compression on your site

Ensure that the browser sends the Accept-encoding: gzip, deflate header

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 text/javascript
AddOutputFilterByType DEFLATE text/js
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:


SetOutputFilter DEFLATE

Test it with this:

curl -s -I -H “Accept-Encoding: gzip” http://www.vickistan.com

[root@web01 wherever.com]# curl -s -I -H “Accept-Encoding: gzip” http://www.vickistan.com
HTTP/1.1 200 OK
Server:
X-Powered-By: PHP
X-Pingback: http://vickistan.com/xmlrpc.php
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Content-Type: text/html; charset=UTF-8
Accept-Ranges: bytes
Date: Mon, 30 Jul 2012 14:55:44 GMT
X-Varnish: 1170541803
Age: 0
Via: 1.1 varnish
Connection: keep-alive

or use this site:

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

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *