SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: PHP Header 404

  1. #1
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Header 404

    Hi guys,

    I have the following code on my page:
    PHP Code:
    <?php
    header
    ("HTTP/1.0 404 Not Found");
    exit();
    ?>
    But apparently it returns me a blank page instead of the default browser page not found. Any ideas?

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two special-case header calls. The first is a header that starts with the string "HTTP/" (case is not significant), which will be used to figure out the HTTP status code to send. For example, if you have configured Apache to use a PHP script to handle requests for missing files (using the ErrorDocument directive), you may want to make sure that your script generates the proper status code.
    http://php.net/header
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply.
    PHP Code:
    <?php
    header
    ("HTTP/1.0 404 Not Found");
    die(
    'Page not found');
    ?>
    I think in this way, humans and search bots can read it properly.


Bookmarks

Posting Permissions

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