Same name and namespace in other branches
  1. 4.6.x includes/common.inc \drupal_not_found()
  2. 4.7.x includes/common.inc \drupal_not_found()
  3. 6.x includes/common.inc \drupal_not_found()
  4. 7.x includes/common.inc \drupal_not_found()

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

16 calls to drupal_not_found()
blog_page in modules/blog/blog.module
Menu callback; displays a Drupal page containing recent blog entries.
file_download in includes/file.inc
Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
locale_admin_manage_delete_form in modules/locale/locale.module
User interface for the language deletion confirmation screen.
menu_edit_item_form in modules/menu/menu.module
Present the menu item editing form.
menu_edit_menu_form in modules/menu/menu.module
Menu callback; handle the adding/editing of a new menu.

... See full list

File

includes/common.inc, line 354
Common functions that many Drupal modules will need to reference.

Code

function drupal_not_found() {
  drupal_set_header('HTTP/1.1 404 Not Found');
  watchdog('page not found', check_plain($_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) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
    drupal_set_title(t('Page not found'));
    menu_set_active_item('');
    $return = '';
  }

  // To conserve CPU and bandwidth, omit the blocks
  print theme('page', $return, FALSE);
}