Share

Updated: June 10th, 2009

12 Responses to “How To Make Your Site Lightning Fast* By Compressing (deflate/gzip) Your HTML, Javascript, CSS, XML, etc In Apache”

    11 Comments:
  1. Joren Rapini says:

    Heh I've never been able to get this to work, more than likely I have to bug my host about it. When I ran phpinfo(), I did not have a Load Modules block section like you talk about here, but I did find a couple sections where gzip and deflate were noted, one of them "HTTP_ACCEPT_ENCODING gzip,deflate ". What do you think?

  2. @Joren
    Mmm, that may not be enough – try to contact your host and alternatively find the place in your configs where modules are loaded.

  3. Mike says:

    Hi,
    I write the line in my .htaccess, but it compress just in the root directory and it don't compress the javascript in my other folder. why ?
    Thanks.

  4. @Mike
    .htaccess should apply to subdirectories by default. Check that no other rule interferes (from httpd.conf, for example) and that those other directories don't override compression settings.

    Finally, see if you can enable all kinds of apache logs and look for clues there.

  5. I just tried the method you described earlier with the .htaccess file and it's incredible.

    I must note that it works not only in localhost webservers, at your own, but in providers webservers also!!

    My webpage's response speed increased 25-40%, without specific measurement to be made!!

    Thanks a lot Artem.

    Web Developer
    Athens, Greece

  6. Brad Ney says:

    I enabled mod_deflate on my server, yet the HTML & JS are not being gzipped. Any ideas?

  7. John Hoff says:

    Good tutorial, Artem. Like you hinted at in the beginning, everyone might want to make sure that visitors to theirs sites aren't composed of a lot of people using older web browsers.

    As far as I know, anything from IE6 service pack 1 and below probably won't show your page correctly if you have compression enabled.

    I'd suggest checking your Analytics program and make sure most of your visitors aren't using these older browsers. You can also check browsershots.org to see how your site will appear to others after you set up compression.

    As an alternative and if you can't get the .htaccess code to work, you could always try enabling compressing through php.

    • Yeah, I remember doing that at first but the PHP technique only compresses PHP files and potentially only your theme file. I would still encourage one to get apache to do the work as it will apply to JS and CSS too.

  8. 1 Ping:
  9. [...] selengkapnya bisa dibaca di G-Loaded Journal, beer planet, Brightscape Blog, dan WordPress [...]

Leave a Reply

Connect with Facebook