? 404.txt ? 76824-14.patch ? 76824-16.patch ? clear-cache.sh ? drupal7.kdevelop ? k7.sql ? mem.php ? old ? patch.sh ? patches ? pi.php ? without-patch.sh ? sites/khead-test ? sites/all/modules ? sites/default/files ? sites/default/private ? sites/default/settings.php Index: .htaccess =================================================================== RCS file: /cvs/drupal/drupal/.htaccess,v retrieving revision 1.108 diff -u -F '^f' -r1.108 .htaccess --- .htaccess 11 Apr 2010 18:33:43 -0000 1.108 +++ .htaccess 1 May 2010 04:31:38 -0000 @@ -16,12 +16,6 @@ # Make Drupal handle any 404 errors. ErrorDocument 404 /index.php -# Force simple error message for requests for non-existent favicon.ico. - - # There is no end quote below, for compatibility with Apache 1.3. - ErrorDocument 404 "The requested file favicon.ico was not found. - - # Set the default handler. DirectoryIndex index.php index.html index.htm Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.382 diff -u -F '^f' -r1.382 bootstrap.inc --- includes/bootstrap.inc 30 Apr 2010 01:33:17 -0000 1.382 +++ includes/bootstrap.inc 1 May 2010 04:31:40 -0000 @@ -2063,6 +2063,27 @@ function drupal_maintenance_theme() { } /** + * Returns a simple 404 Not Found page. + * + * If fast 404 pages are enabled, and this is a matching page then print a + * simple 404 page and exit. + * + * This function is called from drupal_deliver_html_page() at the time when a + * a normal 404 page is generated, but it can also optionally be called directly + * from settings.php to prevent a Drupal bootstrap on these pages. See + * documentation in settings.php for the benefits and drawbacks of using this. + */ +function drupal_fast_404() { + $fast_paths = variable_get('404_fast_paths', FALSE); + if ($fast_paths && preg_match($fast_paths, $_GET['q'])) { + drupal_add_http_header('Status', '404 Not Found'); + $fast_404_html = variable_get('404_fast_html', '404 Not Found

Not Found

The requested URL "@path" was not found on this server.

'); + print strtr($fast_404_html, array('@path', check_plain($_GET['q']))); + exit; + } +} + +/** * Return TRUE if a Drupal installation is currently being attempted. */ function drupal_installation_attempted() { Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1158 diff -u -F '^f' -r1.1158 common.inc --- includes/common.inc 1 May 2010 00:05:04 -0000 1.1158 +++ includes/common.inc 1 May 2010 04:31:45 -0000 @@ -2341,11 +2341,14 @@ function drupal_deliver_html_page($page_ // @todo: Break these up into separate functions? switch ($page_callback_result) { case MENU_NOT_FOUND: + watchdog('page not found', check_plain($_GET['q']), NULL, WATCHDOG_WARNING); + + // Check for and return a fast 404 page if configured. + drupal_fast_404(); + // Print a 404 page. drupal_add_http_header('Status', '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($_GET['destination'])) { $_GET['destination'] = $_GET['q']; @@ -2362,7 +2365,7 @@ function drupal_deliver_html_page($page_ if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) { // Standard 404 handler. drupal_set_title(t('Page not found')); - $return = t('The requested page could not be found.'); + $return = t('The requested page "' . base_path() . check_plain($_GET['q']) . '" could not be found.'); } drupal_set_page_content($return); Index: sites/default/default.settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/default.settings.php,v retrieving revision 1.44 diff -u -F '^f' -r1.44 default.settings.php --- sites/default/default.settings.php 7 Apr 2010 15:07:59 -0000 1.44 +++ sites/default/default.settings.php 1 May 2010 04:31:45 -0000 @@ -393,6 +393,38 @@ # ); /** + * Fast 404 pages: + * + * Drupal can generate fully themed 404 pages. However, some of these responses + * are for images or other resource files that are not displayed to the user. + * This can waste bandwidth, and also generate server load. + * + * The options below return a simple, fast 404 page for URLs matching a + * specific pattern: + * - 404_fast_paths: A regular expression to match paths that should return a + * simple 404 page, rather than the fully themed 404 page. If you don't have + * any aliases ending in htm or html you can add '|s?html?' to the expression. + * - 404_fast_html: The html to return for simple 404 pages. + * + * Add leading hash signs if you would like to disable this functionality. + */ +$conf['404_fast_paths'] = '/.(txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'; +$conf['404_fast_html'] = '404 Not Found

Not Found

The requested URL "@path" was not found on this server.

'; + +/** + * By default, fast 404s are returned as part of the normal page request + * process, which will properly serve valid pages that happen to match and will + * also log actual 404s to the Drupal log. Alternatively you can choose to + * return a 404 now by uncommenting the following line. This will reduce server + * load, but will cause even valid pages that happen to match the pattern to + * return 404s, rather than the actual page. It will also prevent the Drupal + * system log entry. Ensure you understand the effects of this before enabling. + * + * To enable this functionality, remove the leading hash signs below. + */ +# drupal_fast_404(); + +/** * Authorized file system operations: * * The Update manager module included with Drupal provides a mechanism for