WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Random blank pages or incorrectly formatted cached pages served (2 posts)

  1. IntricatePixels
    Member
    Posted 1 year ago #

    WordPress 3.5.1
    W3 Total Cache Plugin 0.9.2.8
    Only Page Cache, Disk Enhanced is enabled.

    I'm getting blank pages randomly on my site. Purging the blank page from cache fixes the issue temporarily. After reading this post, I was able to replicate the blank pages by typing in a url with no trailing slash at the end, like so: http://www.mywebsite.com/section. Not having a forward slash at the end causes the caching plugin to cache a blank (0 bytes) page. Nothing is on that page, even when I view the source code.

    Any ideas to what could be causing this?

    Some details about our current set up that might help determine the root cause of the issue:

    WordPress is running on Windows Azure Cloud, PHP 5.3, IIS and MySQL, and distributed in two servers. As of right now the cache is created on both servers.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. IntricatePixels
    Member
    Posted 1 year ago #

    For anyone else running into this same issue, to fix the problem with W3 Total Cache caching blank pages, I added a url rewrite rule to our server config so that it always add a trailing slash to directories. So, if you type http://www.mywebsite.com/section you're (301) redirected to http://www.mywebsite.com/section/ (note trailing slash at the end). This is performed before W3 Total Cache caches the page.

    Depending on your server configuration, you want to do this in your htaccess file (apache) or your web.config using a rewrite rule (IIS). In IIS you need to have the URL Rewrite Module installed in order to use rewrite rules.

    This is what my IIS rewrite rule looks like in web.config (make sure this comes before any wordpress rewrite rules):

    <rule name="Add trailing slash" stopProcessing="true">
      <match url="(.*[^/])$" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="(.*?)\.html$" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="(.*?)\.aspx$" negate="true" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="{R:1}/" />
    </rule>

    My other issue related to incorrectly formatted cached pages is related to another issue with the Ubermenu plugin and W3 Total Cache.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic