WordPress.org

Ready to get started?Download WordPress

Forums

Quick Cache (Speed Without Compromise)
[resolved] Cached 404 not found pages sending 200 OK headers? Bad for SEO. (4 posts)

  1. jumbo
    Member
    Posted 1 year ago #

    Quick Cache caches 404 not found pages. There's no option to disable this, but that isn't my main concern. The problem is it's serving these 404 pages with the 200 OK header status code instead of the proper 404 not found header.

    This allows 404 pages to be indexed by search engines, which is obviously bad.

    I prefer 404's never be cached, but if they are a 404 status code should always be sent when serving these pages.

    http://wordpress.org/extend/plugins/quick-cache/

  2. Adrià López
    Member
    Posted 1 year ago #

    I'm having the same problem...

  3. jumbo
    Member
    Posted 1 year ago #

    I found a solution that doesn't require hacking the plugin. First, you must have a 404.php template in your theme folder, which should be located here:

    /path_to/wp-content/themes/your_theme_folder/404.php

    In that file, add the following to the top:

    <?php
    if (is_404()) {
        define('QUICK_CACHE_ALLOWED', false);
    }
    ?>

    This is processed before Quick Cache does its thing, and tells it not to cache 404 pages, which assures the 404 status code is always properly sent out. The 'QUICK_CACHE_ALLOWED' constant and instructions for using it this way was actually in the plugin's read me file all along.

    There's a post about this on the official developer's website that suggests putting the code above in a MU (must use plugin), but it didn't work for me. Here's a reference to the URL for those that want to read about it:
    https://www.s2member.com/forums/topic/quick-cache-caching-404-not-found-pages/

    I also came across another post of someone using another method to that optionally allows 404's to be cached, while still sending out the 404 status code. I don't much like that approach because it requires modifying the plugin code, which isn't really future-roof. Here's a reference to that for those that are interested:
    http://techlogon.com/2013/01/06/how-to-prevent-soft-404-errors-in-quick-cache/

  4. nicoter
    Member
    Posted 10 months ago #

    Just noticed that the 404 page sent a 200 ok header which is not cool at all :-/

    @jumbo: Thanks for the solution, this did the trick!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.