Other Random Posts!

38 Comments

  1. Just wish to say your article is as surprising. The clearness on your post is simply excellent and i can assume you’re knowledgeable in this subject. Fine together with your permission let me to seize your feed to keep updated with forthcoming post. Thanks one million and please continue the rewarding work.

  2. Thanks so much for this terrific tip on adding the code in the header.php to speed up site load pages! It worked like a charm and my pages are loading much, much faster. Still have some other things to work on though, like image lossing and some other stuff, but at least things are looking up, and this tip was soooo easy!

  3. I tried and the script @Eddy suggested and got 500 error I am using Ultimate Seo any one have same problem.
    I added as author suggested and got a blank page then I added php so it is

    even then I got blank page.
    Any suggestions

  4. Does this code conflicts with WP Super Cache plugin or WP All in one SEO plugin, It’s showing “Content Encoding Error” during first visit but works on refresh.

  5. I have just checked my site. See the results below. It is a huge difference, really.

    Actual Page Size: 39.39 KB
    Size if Gzipped: 9.19 KB
    Potential Savings: 76.67%

  6. Not working for Drupal.
    Getting the Content Error:
    The page you are trying to view cannot be shown because it uses an invalid “or unsupported form of compression.”

  7. Quick update…this greatly decreased my load time, but it is not really compatible with the All in One SEO plug in – it breaks the title tag. FAS, this could also be the reason for the broken home page title. Are you using All in One SEO plugin?

    For now I’ve removed gzip, installed WP Super Cache, and will consider using another SEO plugin so that I can use gzip.

    Thanks for the great tip…hope to use it again soon!

  8. Thanks for making this so easy. I’m always intimidated by things like this, and the previous suggestions I had read about how to implement gzip compression were beyond me. I added your code to my site in just a few seconds…
    Now I have more time to enjoy that beer!

  9. An alternative solution but guaranteed to work.
    If you have an access to .htaccess file in your WordPress root folder, add this script at the very bottom: (just copy and paste)

    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48, the above regex won’t work. You can use the following
    # workaround (comment the above line and uncomment the below line) to get the desired effect:
    # BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    # Don’t compress already-compressed files
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI .(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary

    # Make sure proxies don’t deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

    # AddDefaultCharset UTF-8
    AddType text/x-component .htc

    php_value upload_max_filesize 128M
    php_value post_max_size 128M
    php_value memory_limit 256M

    php_flag zlib.output_compression On

  10. Thanks for the tip and great explanation. I just finished reading quite a few tips on compression and wish I would have found yours first :)

  11. If anyone suffers from ‘Content Encoding Errors’ after enabling GZIP, double check there is no whitespace before gzip is loaded in the header. I had this and it stumped me for weeks!

  12. To those whose sitemaps and archives are not opening, add this code

    Where X and Y are your pages to exclude from gzip compression.

  13. The compression mentioned may do wonders, especially if quasi-static pages are used (as those generated by Super Cache).

    I would only add that using Apache’ mod_deflate and a .htaccess directive

    SetOutputFilter DEFLATE

    (remember, you can apply it to any type of file using Files directive)

    will apply the GZip compression to files not served by the WP or whatever engine do you use. If you allow downloading files that do compress even a while, that will donate to efficiency.

  14. No sitemaps are not auto generated, sitemap and archives templates are there in the theme. Any solution to the problem? How to exclude sitemap and archives in the GZip compression.

    Plus sometimes the home title changes to something else with this active.

  15. That is weird. I can’t understand why it would work on some pages, but not others. And is your sitemap auto-generated? It shouldn’t even be using the same header.php file as the other stuff!

    John

  16. Great article. I implemented this tip into my wordpress blog and I can already see a difference.

    I also would recommend WP Super Cache as a plugin that you need to have for your wordpress.org blog. It is invaluable!

  17. I never thought of that. Thanks! My friend use to tell me that Gzipping is bad for your site. Maybe it was because he doesn’t know how to do it.

  18. Ok John, its woriking but archives and sitemap are not showing up. It says The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. This happens when the code you have given is added. Any solution?

  19. Great find. But I still would prefer a plug-in ;-) Maybe WP should just come with Supercache by default, that would surely help and we could donate some bytes to people with less bandwith.

  20. I put that code in but Firefox said it was unsupported file compression and would not render the page. Did not work in Safari either (mac versions both). Does WP SuperCache have to be enable for this code to work?

  21. “Content Encoding Error

    The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.”

    That’s if you use google cse search on your site with the default header.

Comments are closed.