Index: .htaccess =================================================================== RCS file: /cvs/drupal/drupal/.htaccess,v retrieving revision 1.96 diff -u -p -u -p -r1.96 .htaccess --- .htaccess 15 Sep 2008 15:21:44 -0000 1.96 +++ .htaccess 18 Nov 2008 01:01:01 -0000 @@ -16,10 +16,17 @@ Options +FollowSymLinks # Make Drupal handle any 404 errors. ErrorDocument 404 /index.php -# Force simple error message for requests for non-existent favicon.ico. - - ErrorDocument 404 "The requested file favicon.ico was not found. - +# The following lines prevents Drupal from handling 404 errors for certain +# types of files, such as images and CSS. +# +# This can help reduce the server's load because 404s for such files do not +# cause a full Drupal bootstrap. + + # If you do not use aliases ending in htm/html replace above line with the + # below. You need to make a similar change in the Rewrite section below. + # + ErrorDocument 404 "404 Not Found

Not Found

The requested URL was not found on this server.

+
# Set the default handler. DirectoryIndex index.php @@ -79,10 +86,23 @@ DirectoryIndex index.php # uncomment the following line: # RewriteBase / + # The following lines prevents Drupal from handling 404 errors for certain + # types of files, such as images and CSS. + # + # This can help reduce the server's load because 404s for such files do not + # cause a full Drupal bootstrap. + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_URI} !/files/ + RewriteCond %{REQUEST_URI} \.(txt|png|gif|jpe?g|shtml?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$ + # If you do not use aliases ending in htm/html replace above line with the + # below. You need to make a similar change in the FilesMatch section above. + # RewriteCond %{REQUEST_URI} \.(txt|png|gif|jpe?g|s?html?|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$ + RewriteCond %{REQUEST_URI} !^404.%1$ + RewriteRule ^(.*)$ 404.%1 [L] + # Rewrite URLs of the form 'x' to the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.104 diff -u -p -u -p -r1.104 system.admin.inc --- modules/system/system.admin.inc 11 Nov 2008 22:39:59 -0000 1.104 +++ modules/system/system.admin.inc 18 Nov 2008 01:01:01 -0000 @@ -1445,7 +1445,7 @@ function system_file_system_settings() { '#title' => t('File system path'), '#default_value' => file_directory_path(), '#maxlength' => 255, - '#description' => t('A file system path where the files will be stored. This directory must exist and be writable by Drupal. If the download method is set to public, this directory must be relative to the Drupal installation directory and be accessible over the web. If the download method is set to private, this directory should not be accessible over the web. Changing this location will modify all download paths and may cause unexpected problems on an existing site.'), + '#description' => t('A file system path where the files will be stored. This directory must exist, be writable by Drupal and contain the word \'files\' somewhere on the path. If the download method is set to public, this directory must be relative to the Drupal installation directory and be accessible over the web. If the download method is set to private, this directory should not be accessible over the web. Changing this location will modify all download paths and may cause unexpected problems on an existing site.'), '#after_build' => array('system_check_directory'), ); @@ -1470,6 +1470,15 @@ function system_file_system_settings() { } /** + * Validate the submitted file handling form. + */ +function system_file_system_settings_validate($form, &$form_state) { + if (strpos($form_state['values']['file_directory_path'], 'files') === FALSE) { + form_set_error('file_directory_path', t("The file system path must contain the word 'files' somewhere on the path for correct 404 handling.")); + } +} + +/** * Form builder; Configure site image toolkit usage. * * @ingroup forms