“the j stands for Jimcrack”
about me | research blog | wordpress plugins | jQuery plugins

25 July, 2010

Enabling compression with GoDaddy Shared Hosting

Compression of HTML, CSS and JavaScript is quite important for improving your site’s speed and should always be used.

Of you will find that all you need to do is add a line similar to the following to your .htaccess file:

AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/x-javascript text/javascript application/javascript
Source: StackOverflow

However, if you’re on a GoDaddy shared hosting account you may have realised that this doesn’t work. GoDaddy’s help page recommends that you paste this code in all your PHP pages:

<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

That’s fine, but from my understanding this will not cache your CSS or JavaScript. However, I found a solution here here, which involves some .htaccess trickery to compress all your CSS and JavaScript files automatically. Enjoy!


  1. Thanks for the article John.
    Godaddy can sure make some of the ‘essentials’ very complicated with having to come up with creative workarounds.

    Comment by Gary — 26 July, 2010 @ 10:49 am

  2. the link doesnt work – can you please provide the info? thanks in advance

    Comment by sean — 9 May, 2013 @ 4:56 pm

Leave a comment