WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Problems with Multisite, subdirectory install (13 posts)

  1. Bill Dennen
    Member
    Posted 3 years ago #

    Hi,

    After running WP Super Cache for quite a while, I decided to try out W3TC on a development server. I completely disabled and remove WP Super Cache before installing W3TC.

    W3TC is causing me problems, though.

    With only Page Caching turned on, I am seeing weird redirects. For example, when I go to the main URL ie: somesite.com/, I get redirected to one of the sub-blogs (somesite.com/subblog). When requesting sub-blogs, I get redirected to sub-pages within other sub-blogs, etc. Something strange is afoot.

    I have W3TC "network enabled". Is this the correct way to enable it on multisite?

    On the settings side, things look ok in my root blog, but when I check the W3TC settings in one of my sub-blogs, I get an error about the .htaccess file:

    You've selected disk caching with enhanced mode however the .htaccess file is not properly configured. Please create an empty file in /.htaccess and run...

    Do I need to configure W3TC in each sub-blog separately, with separate htaccess rules, too? (That would stink.)

    I am seeing these problems for users who are not logged in.

    Thanks.

  2. Bill Dennen
    Member
    Posted 3 years ago #

    Hard to describe what's going on now. Things seem ok with just Page Cache enabled now.

    Now, when I turn on database caching, I see the weird redirects now.

    Also, I have some code that uses switch_to_blog and it pulls in posts from another blog on the same network installation. Permalinks and links to post thumbnails are broken.

    With W3 Total Cache disabled, this code works fine. Only when I enable W3TC do I see this specific problem.

  3. kfawcett
    Member
    Posted 3 years ago #

    W3TC cannot be network enabled. You must enable it on each site. Additionally W3TC needs to add rewrites to your .htaccess file in order to function properly. Since there is only one .htaccess file and all your sites access it you will need to make sure that your settings are the same for all of your sites.

    So you setup your first site and add the proper lines to your .htaccess file. Then when you create each additional site you will get a warning saying that your .htaccess file is not configured correctly. In order for that message to disappear you need to go into the new site and make sure that the settings mirror the settings from your first site.

  4. Bill Dennen
    Member
    Posted 3 years ago #

    Adding this right before my switch_to_blog call seems to solve the permalinks problem.
    wp_cache_flush();

  5. Bill Dennen
    Member
    Posted 3 years ago #

    Thanks kfawcett. This sounds like a major pain, and I've not found any documentation about it, aside from what you wrote. I may need to stick with WP Super Cache.

  6. kfawcett
    Member
    Posted 3 years ago #

    It's not that much of a pain. You only have to do it once per site.

  7. Bill Dennen
    Member
    Posted 3 years ago #

    It looks like the settings should be copied from the main site, upon activation, as Frederick writes here:

    http://wordpress.org/support/topic/plugin-w3-total-cache-wordpress-mu-activation-and-sitewide-cache?replies=12#post-1538529

  8. kfawcett
    Member
    Posted 3 years ago #

    He says in the next release. I'm do not believe that function has made it into the release stream yet.

  9. Bill Dennen
    Member
    Posted 3 years ago #

    Thanks for your help.

    I am still confused by if/when the various htaccess files need to be updated and how. Ideally, one set of htaccess rules would work.

    BUt, it looks like W3TC augments at least one htaccess file and makes it sub-blog specific.

    This one has sub-blog specific statement in it. I did not add it manually, so I assume W3TC did:

    wp-content/w3tc/pgcache/.htaccess

    I may be missing something obvious, but I don't get how this scales.

  10. kfawcett
    Member
    Posted 3 years ago #

    Here's how mine WPMU works. I'm running sub-domains. Not sure if you're the same or if you're running sub-directories

    I have one .htaccess file. I install W3TC and select Active, not Network Active. I setup my first site. I configure W3TC how I want it. I create my next site. I get the warning the the .htaccess file is not correct. I ignore it. I go through the settings for W3TC and make sure they are the same as the first site. The .htaccess warning then goes away. The .htaccess that is in wp-content/w3tc/pgcache/.htaccess is not important. That is not the main .htaccess file for your network. The main .htaccess file should be above your wp-content folder. For me that is the public_html folder. That is where all of the rewrites that are needed go.

  11. Bill Dennen
    Member
    Posted 3 years ago #

    Thanks again. I am running a sub-directory install. Perhaps that is the difference between my setup and yours.

  12. Bill Dennen
    Member
    Posted 3 years ago #

    For what it's worth, if I enable it only for the root blog, things seem fine. The page cache seems to work even for the sub-blogs, even with the plugin not enabled for them. However, I do not get the html comments at the bottom of the page confirming this.

    The reason I think it's working: the cache files for the sub-blogs are created in wp-content/w3tc/pgcache/ and I can edit them and see the edited files being served. Weird.

    But, as I write this, I am not sure this makes any sense.

    Frederick, could you provide some info here? Looking for advice on a subdirectory multisite install. thanks.

  13. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    How you have it set up is fine. I will add super admin controls soon that will make it easier to grok what W3TC is doing on your install.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic