drupal_not_found

Definition

drupal_not_found()
includes/common.inc, line 285

Description

Generates a 404 error if the request can not be handled.

Code

<?php
function drupal_not_found() {
  drupal_set_header('HTTP/1.0 404 Not Found');
  watchdog('page not found', t('%page not found.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING);

  // Keep old path for reference
  if (!isset($_REQUEST['destination'])) {
    $_REQUEST['destination'] = $_GET['q'];
  }

  $path = drupal_get_normal_path(variable_get('site_404', ''));
  if ($path && $path != $_GET['q']) {
    menu_set_active_item($path);
    $return = menu_execute_active_handler();
  }
  else {
    // Redirect to a non-existent menu item to make possible tabs disappear.
    menu_set_active_item('');
  }

  if (empty($return)) {
    drupal_set_title(t('Page not found'));
  }
  print theme('page', $return);
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.