Ignore:
Timestamp:
Apr 28, 2006, 7:11:46 AM (18 years ago)
Author:
rvelices
Message:

bug 349: Nicer display messages instead of "die" when urls cannot be
solved (also set 404 status code for bots)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1_6/include/functions_html.inc.php

    r1275 r1287  
    592592  }
    593593}
     594
     595/**
     596 * exits the current script with 404 code when a page cannot be found
     597 * @param string msg a message to display
     598 * @param string alternate_url redirect to this url
     599 */
     600function page_not_found($msg, $alternate_url=null)
     601{
     602  header('HTTP/1.1 404 Not found');
     603  header('Status: 404 Not found');
     604  if ($alternate_url==null)
     605    $alternate_url = make_index_url();
     606  redirect( $alternate_url,
     607    '<div style="text-align:left; margin-left:5em;margin-bottom:5em;">
     608<h1 style="text-align:left; font-size:36px;">Page not found</h1><br/>'
     609.$msg.'</div>',
     610    5 );
     611}
    594612?>
Note: See TracChangeset for help on using the changeset viewer.