PHP header()
Results 1 to 4 of 4

Thread: PHP header()

  1. #1

    PHP header()

    Quick question, this is such a little problem but I need to get it working. I need PHP to send a browser to it's local 404 page, exactly the same way it would if a page didn't exist. Here's what I'm trying:

    PHP Code:
    ("HTTP/1.0 404 Not Found");
    This page should send your browser to a 404 page located on your filesystem, however it isn't on the servers I'm using. A "location:" redirect works fine, however this doesn't. The most embarrasing part is that I pulled that code directly from the PHP site, and it still doesn't work.

    I'm reading this but most of it is going over my head:

    What can I do with php to get the browser to show the local filesystem's 404 page?

  2. #2
    Join Date
    Aug 2001
    Doesn't this only work if Apache is configured correctly through ErrorDocuments? I don't think that script can be used universally...


    PHP Code:
    ("HTTP/1.1 404 Not Found");
    doesn't do anything in Firefox, but it does work in IE... Can it be that Firefox strips the headers or something?

  3. #3
    Join Date
    Nov 2003
    yes HTTP/1.1

  4. #4
    Junior Member
    Join Date
    Aug 2003
    all that header command is doing is defining that the page you are sending doesnt exist, it is sending the 404 error.

    if you want it to go to the actual 404 error page you have defined in the .htaccess you will have to either include it yourself and generate it as part of the page or redirect to it using :

    header ('Locate http://domain/404error.html');

    or what have you

Posting Permissions

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