We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28033
    • 925 Posts
    http://www.ilovejackdaniels.com/php/php-gzip-and-htaccess/

    Requires two lines in the beginning of your .htaccess file, and two small .php files to be created.

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

    Type in http://symphonicheaven.com and see the results. It cut the page load by almost 3/4. Try going to that URL directly, let it load, then reload the page again. Notice a difference?

    Of course, if certain files are known to have issues with this, they could exclude them easily (either by disabling the option in the script, or using an exclude command). BTW, if someone knows how to do that via htaccess, please post it --- I’d like to see how it’s done. grin

    Also, note that scripts that use GZIP and have them enabled (such as some forums) will mess up unless you either remove that functionality or do a exclude command to exclude that directory. This is because it will try to GZIP the page "twice", causing issues --- Case in point MyBB, which has it’s own GZIP option in the AdminCP.

    (I know there’s other server ways to do this, but I don’t have direct access to them, so I have to use this type of method.)
      My Snippets
      -> PopUpChunk v1.0
      • 1734
      • 13 Posts
      Hi,

      I hope it’s ok. to reply to this relatively old topic... First off, thanks for this great advice, really reduces loading times. Unfortunately I have a problem with this solution: The MODx manager stays blank. I guess I could easily exclude it in the .htaccess, but - you guess it - I don’t know how... So, did anyone experience the same thing and got it working?

      Thanks, AnnaStesia
        • 1734
        • 13 Posts
        Aaaaah, thanks a lot, works like charm! smiley
          • 20288
          • 132 Posts
          Quote from: ganeshXL at Sep 02, 2008, 12:14 PM

          The default MODx .htaccess file comes already with that option. By default, these config lines are deactivated:

          # For servers that support output compression, you should pick up a bit of
          # speed but un-commenting the following lines.
          
          #php_flag zlib.output_compression On
          #php_value zlib.output_compression_level 5


          Just remove the # in the last 2 lines, and see for yourself if it works. If it clashes in the manager, just change the manager/.htaccess file accordingly, i.e. an explicit
          php_flag zlib.output_compression Off

          should do.

          more infos: http://ch2.php.net/manual/en/zlib.configuration.php

          Hey Ganesh, sorry to bring up such an old post, but I’m looking for some assistance. I’m trying to just uncomment the two lines you posted above, and when I do so, I get an Internal Server Error, and my entire site doesn’t load. I uncommented these lines in the main .htaccess file in the root folder.

          Any ideas?
            • 20288
            • 132 Posts
            Quote from: ganeshXL at Dec 01, 2008, 10:28 AM

            Ask your hosting provider if they support this feature. If they do, maybe you need to add those line in your custom php.ini file (instead of .htaccess). Depends on the server config etc.

            Ahhh ok... didn’t even think about the host not supporting it. I’ll ask them. Thanks a lot.