Results 1 to 6 of 6

custom 404 Error Doc returns 200 OK

This is a discussion on custom 404 Error Doc returns 200 OK within the Troubleshooting forums, part of the vBSEO SEO Plugin category; When specifying a 404 error document in vBSEO cp , the header returned for 404 errors is 200 OK This ...

  1. #1
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times

    custom 404 Error Doc returns 200 OK

    When specifying a 404 error document in vBSEO cp, the header returned for 404 errors is 200 OK

    This is far from ideal...

    I even have header("HTTP/1.0 404 Not Found"); in my 404 php file... Is vBSEO over-riding this?
    Rob - SEO Specialist

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    Hello Rob,

    yes, the header should be sent from the included script and vBSEO doesn't prevent this. Make sure that header() is executed before the output starts.

  3. #3
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times
    Quote Originally Posted by Oleg Ignatiuk
    Hello Rob,

    yes, the header should be sent from the included script and vBSEO doesn't prevent this. Make sure that header() is executed before the output starts.
    ..... it is, this is php file:-
    Code:
    <?php
    
    // ####################### SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);
    
    // #################### DEFINE IMPORTANT CONSTANTS #######################
    define('NO_REGISTER_GLOBALS', 1);
    define('THIS_SCRIPT', '404.php'); /
    header("HTTP/1.0 404 Not Found");
    // ################### PRE-CACHE TEMPLATES AND DATA ######################
    // get special phrase groups
    $phrasegroups = array(
    
    );
    
    // get special data templates from the datastore
    $specialtemplates = array(
    
    );
    
    // pre-cache templates used by all actions
    $globaltemplates = array(
        '404_error',
    );
    
    // pre-cache templates used by specific actions
    $actiontemplates = array(
    
    );
    
    // ######################### REQUIRE BACK-END ############################
    require_once('./global.php');
    
    // #######################################################################
    // ######################## START MAIN SCRIPT ############################
    // #######################################################################
    
        $domain = $_SERVER['HTTP_HOST'];
    
        $navbits = array();
        $navbits[$parent] = 'Error 404 - Not Found';
        $navbits = construct_navbits($navbits);
        eval('$navbar = "' . fetch_template('navbar') . '";');
        eval('print_output("' . fetch_template('404_error') . '");');
    ?>
    Yet it's still returning 200 OK
    Rob - SEO Specialist

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    This script returns 404 in my case, may be it's related to vBulletin? Please try a simple case like:
    PHP Code:
    <?php
               Header 
    ("HTTP/1.1 404 Not Found");
            echo 
    'Error 404 - Not Found';
    ?>
    Last edited by Oleg Ignatiuk; 05-29-2006 at 04:18 PM.

  5. #5
    rob
    rob is offline
    Senior Member rob's Avatar
    Real Name
    Rob
    Join Date
    Oct 2005
    Location
    Eastbourne, UK
    Posts
    982
    Liked
    2 times
    fixed....

    I put the header after the global.php include and now works properly.... thanks.
    Rob - SEO Specialist

  6. #6
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    Great!

Similar Threads

  1. Syntax for Custom Rewrite Rules
    By Joe Ward in forum Custom Rewrite Rules
    Replies: 33
    Last Post: 02-10-2011, 08:49 PM
  2. 404 and 200 Google problems
    By HappyDJ in forum URL Rewrite Settings
    Replies: 2
    Last Post: 05-09-2006, 02:51 PM
  3. vBSEO 2.0 RC7 Released
    By Juan Muriente in forum vBSEO Announcements
    Replies: 17
    Last Post: 09-08-2005, 11:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •