WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Disk Enhanced Mode breaks forced "www" (9 posts)

  1. eatingrules
    Member
    Posted 3 years ago #

    Hi All,

    I think I just found a bug in W3 Total Cache. I emailed W3 EDGE using their form, but figured I'd post here as well. Hopefully it's useful for someone.

    I've got WordPress configured to http://www.eatingrules.com, and it normally adds the "www" if it wasn't typed in by the visitor... Working exactly as WP should.

    However, when Page Caching (Disk Enhanced) is enabled, it breaks the forced "www" on the site's url. If someone goes to http://eatingrules.com, that's where they'll stay (the redirect just doesn't happen).

    In Page Caching (Disk) mode, it works fine. As soon as I enable Disk Enhanced, however, the "www" is no longer added to the URL if necessary.

    I'm running WP 3.2 and W3TC 0.9.2.3. Server is Apache, hosted on MediaTemple's Grid-Servce.

    Any ideas?

    Thanks!

    - Andrew

  2. Mike
    Member
    Posted 3 years ago #

    Check this out: http://wordpress.org/support/topic/plugin-w3-total-cache-non-www-redirect-fails-with-w3tc-activated?replies=20#post-2041265

    By the way, how's WP 3.2 working with W3TC 0.9.2.3 otherwise? I've been hesitant to upgrade with all the previous issues.

  3. eatingrules
    Member
    Posted 3 years ago #

    Hi Mike,

    Thanks for sending me to that thread -- with all my searching, I'm surprised I hadn't seen that one yet! :)

    I heard back from Frederick last night. He suggested making sure the WordPress Rewrite rules were at the very top of my .htaccess file (above the W3TC rewrite rules).

    That solved it for internal pages, but the homepage is still not redirecting from eatingrules.com -> http://www.eatingrules.com.

    Otherwise, WP3.2 and W3TC 0.9.2.3 are playing just fine with each other. I have Page Cache (Disk Enhanced, with cache preloading), HTML and CSS minnification, Object Caching, and CDN (Rackspace Files) all enabled.

    Still need to do some trial & error with the settings to see where the "sweet spot" of performance lands, but other than the www rewrite issue, all is well.

  4. eatingrules
    Member
    Posted 3 years ago #

    Oh, just went back and read through the thread you recommended. Added

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    To the very top of my .htaccess file, and that solved it!

    So now the first chunk of my .htaccess file looks like this:

    # Redirect eatingrules.com -> www.eatingrules.com
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    # BEGIN W3TC Browser Cache

    Thanks again!

  5. Mike
    Member
    Posted 3 years ago #

    You have minify working? Wow, seems like that's been broken for everyone in the latest few W3TC versions. Are you using minify in auto or manual mode?

    thanks,
    Mike

  6. eatingrules
    Member
    Posted 3 years ago #

    Auto mode.

    I've got HTML and CSS minification on, but am NOT minifying Javascript. I'm not minifying inline CSS, JS, or Feeds, either.

    I also just remembered that I offloaded a minified version of my CSS file to my CDN server... so the CSS minification may not actually be doing anything right now.

    HTML is definitely being minified successfully, though! Go to my site and view source... :) http://www.eatingrules.com

  7. Mike
    Member
    Posted 3 years ago #

    Well, I finally got the nerve to upgrade and the sky didn't fall. However, I tired your minify settings and it totally jacked-up my CSS, so I had to turn off Minify again. At least I'm no worse off than I was before the upgrade - everything working in W3TC except minify. I might try to minify HTML only ... we'll see.

  8. eatingrules
    Member
    Posted 3 years ago #

    Glad to hear your site's not broken, at least! :)

    In the grand scheme, I think minnification isn't all that important. Much more important to have caching, highly-compressed (or fewer) images, fewer HTTP requests/lookups, and a CDN to serve static files.

    If you still want to minify, I think you could install the WP Minify plugin -- just be sure to have minify turned off in W3TC. (Pretty sure they'll play nice with each other?).

    http://wordpress.org/extend/plugins/wp-minify/

    ALSO, Frederick and I have been emailing a bit about the WWW redirect issue. He clarified that the .htaccess rules should be set up in this order:

    1. "www" Redirect
    2. W3TC Redirects
    3. WP Redirects

    # Redirect eatingrules.com -> www.eatingrules.com
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    # BEGIN W3TC Browser Cache
    <IfModule mod_mime.c>
    [...]
    </IfModule>
    # END W3TC Page Cache core
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  9. Frederick Townes
    Member
    Plugin Author

    Posted 3 years ago #

    Sorry for the trouble everyone.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic