Development custom 404 messages

Discussion in 'Software' started by Phire, 24 Apr 2002.

  1. Phire

    Phire Performance-PCs.com

    Joined:
    11 Jan 2002
    Posts:
    1,441
    Likes Received:
    0
    How do I implement custom 404 messages? Meaning, if a link to another file doesnt work, how do I implement the file that comes up and says "oops, we couldnt find that file" Like this:
    [​IMG]
     
  2. linear

    linear Minimodder

    Joined:
    5 Oct 2001
    Posts:
    4,393
    Likes Received:
    1
    You need an ErrorDocument directive in your .htaccess file:

    for example the above would return /404.php for any 404 errors. Note that it can be a script and do actual things with the URL, such as generate a mail to the webmaster or try to suggest a substitute, redirect a moved page, or whatever.

    The manual: http://httpd.apache.org/docs/mod/core.html#errordocument

    Fun error pages collected: area 404

    403 and other errors can have their own pages too, of course.
     
  3. pszaro

    pszaro What's a Dremel?

    Joined:
    11 Mar 2002
    Posts:
    206
    Likes Received:
    0
  4. Phil

    Phil What's a Dremel?

    Joined:
    19 Jul 2001
    Posts:
    1,005
    Likes Received:
    0
    I tried to do this recently and it didn't work so well...

    I did it server wide - so the ErrorDocument line waqs in http.conf not a .htaccess file.

    I tried to use an shtml page i'd found an instruction to build from the apache website...but it didn't really work.

    It was supposed to display the name of the url you tried to find but it couldn't, an detect whether you came there from a link or typed it directly. didn't really work....

    only thing it did do right was display the correct time...

    I really must learn how to code things properly again, I haven't done any web developement is earnest since i was 17, 4 years ago.
     

Share This Page