WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
gzip compression working only for logged in user (9 posts)

  1. giladpn
    Member
    Posted 4 years ago #

    Hi and thanks in advance for any answers

    I've done a very straightforward installation of super-cache plugin, with compression enabled.

    Plugin version is 0.9.9.3 (the current one from wordpress.org).

    You can see our working website on http://www.porticor.com/

    What I am seeing is like this.

    When I log on to the WP admin environment in one tab, and open the website in another browser tab, compression works. At the bottom of any page, I see the HTML comment "<!-- Compression = gzip -->"

    If I now log out - which means I see the website like a regular user hitting the site - compression does not work. At the bottom of any page, I see "<!-- super cache -->". Also Google PageSpeed tells me its no longer gzipped.

    In order to double check, I have just reinstalled after removing. So its a clean install. Problem still occurs.

    Its been tested on both Chrome and Firefox. Happens on both consistently.

    I have enabled the following super-cache options:
    - fully "on"
    - mobile device support
    - super cache compression
    - updated mod_rewrite rules
    - all other options are default values

    Additional info on the environment:
    - WP 3.0 install
    - theme is the "enterprise" theme from http://www.studiopress.com/
    - installed plugins include
    All in One Webmaster
    Google XML Sitemaps
    Official StatCounter Plugin
    SlideShare plugin
    Wickett Twitter Widget
    WordPress Importer
    WP Super Cache

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 4 years ago #

    Have you tried the debugging system in the plugin? That will tell you a lot.

  3. giladpn
    Member
    Posted 4 years ago #

    Thanks for the tip. Here is what I discovered. I am getting logging messages of the following form [used .... to snip out some meaningless numbers].

    supercache dir: /home/content/...../html/wp-content/cache/supercache/www.porticor.com/
    Served page from supercache file. Mod rewrite rules may be broken or missing.

    OK, so I did the obvious step of pressing "view mod_rewrite rules" in the plugin page. They look fine. Here they are below. By the way, it says "Rules must be added to .../html/wp-content/cache/.htaccess too:" and I did indeed check they are added fine in that location.

    But the problem is still there. Any advice?

    ============

    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).*
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/home/content/..../html/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
    RewriteRule ^(.*) "/home/content/....../html/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz" [L]

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).*
    RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).*
    RewriteCond %{DOCUMENT_ROOT}/home/content/......./html/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
    RewriteRule ^(.*) "/home/content/......../html/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html" [L]
    </IfModule>
    # END WPSuperCache

    Rules must be added to ...../html/wp-content/cache/.htaccess too:

    # BEGIN supercache
    <IfModule mod_mime.c>
    <FilesMatch "\.html\.gz$">
    ForceType text/html
    FileETag None
    </FilesMatch>
    AddEncoding gzip .gz
    AddType text/html .gz
    </IfModule>
    <IfModule mod_deflate.c>
    SetEnvIfNoCase Request_URI \.gz$ no-gzip
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    Header set Cache-Control 'max-age=300, must-revalidate'
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html A300
    </IfModule>
    # END supercache

  4. Donncha O Caoimh
    Member
    Plugin Author

    Posted 4 years ago #

    That's not the debug system. It's half way down the admin page.

    Also, in your supercache directory, are there index.html.gz files in each sub-directory?

  5. giladpn
    Member
    Posted 4 years ago #

    sorry I was unclear. The messages

    Quote
    supercache dir: /home/content/...../html/wp-content/cache/supercache/www.porticor.com/
    Served page from supercache file. Mod rewrite rules may be broken or missing.
    End quote

    come from the debug system. I enabled the debug system and got these as email when I tried to access various pages.

    (after that I also checked the mod rewrite rules, and copied them too. you have them above).

    As regards your Q on the index.html.gz in the supercache directory. The supercache directory has 13 sub-directories (counting all nestined directories as well). Out of these, 3 do have index.html.gz files, and the rest do not.

    However the presence of an index.html.gz file does not seem to make a difference. for example the subdirectory

    supercache/www.porticor.com/register

    does have such a file. But when I access it - the page I get is NOT gzipped. You can see that page here:

    http://www.porticor.com/register/

    Thanks again for all the guidance.

  6. giladpn
    Member
    Posted 4 years ago #

    Hi, any input in the additional info I gave above? Thanks.

  7. Donncha O Caoimh
    Member
    Plugin Author

    Posted 4 years ago #

    The mod_rewrite rules are broken, you need to look at the .htaccess again. The rules above need to be above the regular WordPress rules.

    What you're seeing is the last ditch effort by the plugin to serve a cached file.

  8. giladpn
    Member
    Posted 4 years ago #

    so sorry, but th emod_rewrite rules for supercache were indeed above the regular wordpress rules.

  9. giladpn
    Member
    Posted 4 years ago #

    Well sorry, as this had no workable answer I had to uninstall the plugin. I hope to revisit it - its otherwise quite useful - once more info is added on the topic.

    Thanks for answering my Qs. I appreciate the support.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic