From e120a6e886a40eaf135f6032aa47e3eeeb58b3af Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 30 Sep 2011 15:00:38 -0700 Subject: Issue #76824 by geerlingguy, xjm, droplet, kbahey: Change notice for Drupal should not handle 404 for certain files. --- sites/default/default.settings.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'sites/default') diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 32160598d..8479cf5d4 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -428,6 +428,42 @@ ini_set('session.cookie_lifetime', 2000000); # 'a.b.c.d', # ); +/** + * 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_exclude: A regular expression to match paths to exclude, + * such as images generated by image styles, or dynamically-resized images. + * If you need to add more paths, you can add '|path' to the expression. + * - 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_exclude'] = '/\/(?:styles)\//'; +$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 sign below. + */ +# drupal_fast_404(); + /** * Authorized file system operations: * -- cgit v1.2.3