WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
[resolved] "Served supercache file from PHP". Cannot get static cache to wor (4 posts)

  1. ymf
    Member
    Posted 2 years ago #

    I fresh re-installed WP Super Cache 1.0 and checked all "Recommended" settings such as "Use mod_rewrite to serve cache files" on the Advanced tab. The only non-"Recommended" option that I checked is "Mobile device support" (I have WPTouch plugin).

    However the "mod_rewrite" caching does not seem to work: when I view HTTP headers (e.g. via http://web-sniffer.net/ ), I see "WP-Super-Cache: Served supercache file from PHP".

    I went through the troubleshooting steps at the bottom of http://wordpress.org/extend/plugins/wp-super-cache/faq/ and has not spotted anything suspicious. Any pointers regarding where I should look harder? The site in question is http://goo.gl/CKiLg .

  2. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    I don't know why that's happening but you won't see any difference in reality. There's a minuscule difference for normal traffic, the only win is where your site is hit by a huge deluge of traffic suddenly.

  3. ymf
    Member
    Posted 2 years ago #

    Could it be because WP is installed in a subdirectory (/wordpress)? Or a conflict between .htaccess files? For some reason I have three of them:

    #1. /.htaccess :

    # BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
    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).* [NC]
    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-).* [NC]
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTPS} on
    RewriteCond %{DOCUMENT_ROOT}/wordpress/wp-content/cache/supercache/%{HTTP_HOST}/$1/index-https.html.gz -f
    RewriteRule ^(.*) "/wordpress/wp-content/cache/supercache/%{HTTP_HOST}/$1/index-https.html.gz" [L]
    </IfModule>
    # END WPSuperCache
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    #2. /wordpress/.htaccess :

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]
    </IfModule>
    # END WordPress

    #3. /wordpress/wp-content/cache/.htaccess :

    # 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=3, must-revalidate'
    </IfModule>
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType text/html A3
    </IfModule>
    # END supercache
  4. ymf
    Member
    Posted 2 years ago #

    Doncha,

    I think I found the cause -- a conflict with (or intentional behavior of?) the "Ad Injection" plugin.

    Some pages (those where Ad Injection displays ads) are cached as ".php" (e.g. "/wordpress/wp-content/cache/supercache/example.com/some-post-name/index.html.php" or "/wordpress/wp-content/cache/supercache/example.com/index.html.php"). These cache pages are served in half-mode (a string "WP-Super-Cache: Served supercache file from PHP" is seen in the HTTP header).

    Other pages (without ads) are cached as .html / .html.gz pair (e.g. "/wordpress/wp-content/cache/supercache/example.com/some-page-name/index.html" and "/wordpress/wp-content/cache/supercache/example.com/some-page-name/index.html.gz"). Those cache pages are served in full mode by mod_rewrite, skipping PHP.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic