• oh_hello

    (@oh_hello)


    Hi All,

    It seems that when I activate the Page Cache using W3 Total Cache, it causes my homepage to return a 404 – page not found error.

    This happens whether I leave the “Cache front page” checked or unchecked.

    It doesn’t appear to affect any other pages on my site, only the homepage.

    The site is horse-canada.com but Page Cache is disabled at the moment because obviously I want the homepage to work.

    Any thoughts on what could be causing the issue? Thanks.

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Kimberly

    (@amiga500)

    HI, my fellow Canadian brother or sister ?? ! Hard to say what the problem is without more investigation. Questions:

    1. When page cache is enabled and u leave off “Cache front page” you mention it does not affect the other pages. Does that mean the pages are caching successfully (a page cache file for each page is generated in the cache folder)?

    2. When you have it cache the front page is it actually returning a 404 error or is the page returning a blank html page? Do you have something like Firebug installed so you can see what the real http error code is and if the resulting page (if any) has any content in it ? It might give further clues as to whats going on.

    3. Can you switch your page cache from “Disk Enhanced” to “Disk”? Assuming it is currently at “disk enhanced”. If its not that then what is it currently set to?

    Thanks
    Kimberly

    Thread Starter oh_hello

    (@oh_hello)

    Thanks for the reply, Go Canada!

    1. I believe so. I see a bunch of files/folders in /wp-content/cache/page_enhanced/www.horse-canada.com. Is that the cache folder you mentioned?

    2. It’s an actual 404, my 404 error template appears not just a blank page.

    3. Switching to Disk: Basic from Disk: Enhanced appears to work. Any thoughts on why that could be?

    Kimberly

    (@amiga500)

    Ah ok it seems to be a misconfiguring in your htaccess file. I could be wrong but i get a sense it is attempting to locate the cached home page index.html file but when it redirects to it (via htaccess file) it is missing (causing your 404 page to show).

    btw, yes i was indeed referring to your “/wp-content/cache/page_enhanced/www.horse-canada.com” cache folder. Good to know files were being generated.

    When u set it to “Disk basic” it actually no longer uses htaccess to redirect to your cache folder but gets its cache via a call to advanced_cache.php located in your wp-content folder. I just was curious to see if it is possibly an htaccess issue…and it seems to be.

    I’m sure although you have disk basic on yor files/folders inside page_enhanced is still there so can you check inside: /wp-content/cache/page_enhanced/www.horse-canada.com/ … do you see these files in this directory:

    _index.html
    _index.html_gzip

    Can you view _index.html and verify that it is indeed your home page? Let me know if it is (or if its missing).

    Can you put it back to disk:enhanced briefly and check your root’s htaccess file and copy/paste the full section (as generated by w3tc) that starts with: # BEGIN W3TC Page Cache core and ends with # END W3TC Page Cache core. Dont worry nothing in that region will expose any private things about your site/server.

    What confuses me is why your other pages get cached fine but your home page fails. It’s possible there might be something (unrelated to w3tc) that is doing something else to the homepage. But for now we will just work with what we have now.

    Thread Starter oh_hello

    (@oh_hello)

    I checked the cache folder and this is the only file present in the main directory: _index.html_gzip.old. No _index.html or _index.html_gzip.

    Here is the copied section you requested:

    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=W3TC_ENC:_gzip]
        RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
        RewriteRule .* - [E=W3TC_PREVIEW:_preview]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{REQUEST_URI} \/$
        RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
        RewriteCond %{HTTP_USER_AGENT} !(W3\ Total\ Cache/0\.9\.4\.1) [NC]
        RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
        RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    </IfModule>
    # END W3TC Page Cache core

    Thanks!

    Thread Starter oh_hello

    (@oh_hello)

    Any thoughts on this? The issue is still persisting.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page cache causes 404 error on homepage’ is closed to new replies.