Support » Plugin: W3 Total Cache » WT3C shows random pages in multisite installation

  • Hello,

    I love WT3C! It brought two of my websites from over 5 seconds to about 2 seconds and from over 3 seconds to 1,2 seconds. That’s just great.
    But, unfortunately I’ve got a multisite installment, containing website A, website B and so on … and now WT3C delivers random homepages in different browser windows – so that if I type in the URL of site A, in Chrome I get site B, in Firefox site C, in Safari I get the right site A, but in Opera site D … Kind of strange 🙂
    I don’t know how to fix this … Maybe it would help if I knew, where in the code WT3C does fetch the different pages from? Or – is there another workaround to get it right?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had a similar issue when I put multiple WordPress installations on the same server (not multisite — just multiple installations on the same server). The problem was that the APC/memcached cache was shared between the installations so they would retrieve each other’s cached objects. I’m wondering if something like that could be affecting you.

    I fixed the problem by modifying the code to make the cache key unique:

    Thank you laurinb,

    for I am not a php programmer I have to follow your guidance step by step like a virtual sheep … better I ask back, before I crash everything here …

    In w3-total-cache/wp-content/db.php I write it that way, right?:

    if (!@is_dir(W3TC_DIR) || !file_exists(W3TC_DIR . '/inc/define.php')) {
        if (!defined('WP_ADMIN')) { // lets don't show error on front end
            require_once (ABSPATH . WPINC . '/wp-db.php');
        } else {
            @header('HTTP/1.1 503 Service Unavailable');
            die(sprintf('<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__));
    $key = md5(__FILE__) . '_' . $key;
    } else {
        require_once W3TC_DIR . '/inc/define.php';
        $config = & w3_instance('W3_Config');
        if ($config->get_boolean('dbcache.enabled')) {
            if (defined('DB_TYPE')) {
                $db_driver_path = sprintf('%s/Db/%s.php', W3TC_LIB_W3_DIR, DB_TYPE);
    $key = md5(__FILE__) . '_' . $key;
                if (file_exists($db_driver_path)) {
                    require_once $db_driver_path;
                } else {
                    die(sprintf('<strong>W3 Total Cache Error:</strong> database driver doesn\'t exist: %s.', $db_driver_path));
    $key = md5(__FILE__) . '_' . $key;

    Thanks again!

    That isn’t the right place to make the change.

    First I want to make sure this might help. A few questions:
    – Do you have a wordpress multisite installation, or did you just install multiple wordpress blogs on the same machine?
    – What type of caching are you using (memcached, APC, disk, disk enhanced)?

    Thanks for coming back, larionb.

    I have a single database with a multidomain wordpress installation and several blogs running on it. A friend of mine set it up for me by adding some lines to the config.php, I couldn’t have done it. It’s a hack by Richard Martin:
    $table_prefix = ereg_replace(‘^(www\.)’, ”, $_SERVER['HTTP_HOST']); $table_prefix = ereg_replace(‘\.’, ”, $table_prefix); $table_prefix = ereg_replace(‘\-’,”, $table_prefix); $table_prefix = $table_prefix . ‘_’;
    It works very fine, e.g. if I install a plugin on one of the websites, the other sites have got it too, it just has to be activated there. The only issue I had until today was creating the xml-sitemap by the Google XML Sitemap plugin (every single blog tried to create a “sitemap.xml” in the same root directory, and I had to rename them to sitemapblog1.xml, sitemapblog2.xml …, so that each blog has it’s own one now). The two problems seem to me as if they are somehow related … Maybe WT3C tries to find and use the sitemap, so that’s a possible source of error too.

    My hoster doesn’t allow me to use APC or memcache, so it’s just disk.

    Does anything of this help?

    It looks like you have just one WordPress installation, but with multiple blogs. The way that W3TC works it can’t differentiate between the different cached pages for those blogs. The hack that I linked to won’t work because it relies on having different wordpress installations.

    Ok, but thanks for trying, laurionb!
    Maybe anyone else knows how to deal with the problem?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WT3C shows random pages in multisite installation’ is closed to new replies.