Same name and namespace in other branches
- 4.6.x includes/common.inc \drupal_not_found()
- 4.7.x includes/common.inc \drupal_not_found()
- 5.x includes/common.inc \drupal_not_found()
- 7.x includes/common.inc \drupal_not_found()
Generates a 404 error if the request can not be handled.
Related topics
8 calls to drupal_not_found()
- 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_languages_delete_form in includes/
locale.inc - User interface for the language deletion confirmation screen.
- profile_browse in modules/
profile/ profile.pages.inc - Menu callback; display a list of user information.
- profile_field_delete in modules/
profile/ profile.admin.inc - Menu callback; deletes a field from all user profiles.
- profile_field_form in modules/
profile/ profile.admin.inc - Menu callback: Generate a form to add/edit a user profile field.
File
- includes/
common.inc, line 393 - Common functions that many Drupal modules will need to reference.
Code
function drupal_not_found() {
drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
watchdog('page not found', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
// Keep old path for reference, and to allow forms to redirect to it.
if (!isset($_REQUEST['destination'])) {
// Make sure that the current path is not interpreted as external URL.
if (!menu_path_is_external($_GET['q'])) {
$_REQUEST['destination'] = $_GET['q'];
}
}
$path = drupal_get_normal_path(variable_get('site_404', ''));
if ($path && $path != $_GET['q']) {
// Set the active item in case there are tabs to display, or other
// dependencies on the path.
menu_set_active_item($path);
$return = menu_execute_active_handler($path);
}
if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
drupal_set_title(t('Page not found'));
$return = t('The requested page could not be found.');
}
// To conserve CPU and bandwidth, omit the blocks.
print theme('page', $return, FALSE);
}