• Hi there,

    I have a 404.php template within my theme, and within that it simply echo’s out ‘404’ with some simple php. Pretty simple.

    Importantly in the header.php of my theme I use the following php code
    to pull the 404 page when needed.

    <?php
    
    if (!have_posts()) {
    header("HTTP/1.0 404 Not Found");
    $wp_query->set_404();
    require TEMPLATEPATH.'/404.php';
    exit;
    }
    else{
    
    LOADS NORMAL HEADER STUFF HERE
    
    }
    ?>

    Weirdly this works in as much as the logic kicks in and the 404 page loads when expected and when doesn’t load when it is not needed so that’s all good, but when checking the header response through google webmaster tools and others like webconfs.com it shows as a 302 FOUND for pages that simply don’t exist!!

    Frustrating as I want to return HARD 404 responses not a SOFT 404 to Google. Has anyone else dealt with this before? Quite an annoying SEO oversight.

    Many thanks in advance as always!

    Bowser

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bossbowser

    (@bossbowser)

    Weirdly Chrome in its debug console give me the HARD 404 but google webmaster and all other online header checkers show me a 302 redirect.

    Surely someone has had to deal with this???

    Thread Starter bossbowser

    (@bossbowser)

    Anyone???

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Prevent Soft 404 and force a HARD 404 header response’ is closed to new replies.