If page not found, then 404 - pls check my code...

Discussion in 'PHP' started by Kerosene, Nov 8, 2007.

  1. #1
    I know it's not pretty, but is this all I have to do to send Google (and friends) a 404?

    header("HTTP/1.0 404 Not Found");
    echo '404 not found';
    exit;
    Code (markup):
     
    Kerosene, Nov 8, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    That would work. And since PHP 4.3.0, you can do it this way as well.
    
    header(' ', true, 404);
    exit();
    
    PHP:
     
    nico_swd, Nov 8, 2007 IP