Index: .htaccess
===================================================================
RCS file: /cvs/drupal/drupal/.htaccess,v
retrieving revision 1.80
diff -u -F^f -r1.80 .htaccess
--- .htaccess	30 Dec 2006 20:54:54 -0000	1.80
+++ .htaccess	4 Jan 2007 03:57:58 -0000
@@ -16,6 +16,16 @@
 # Customized error messages.
 ErrorDocument 404 /index.php
 
+# The following line prevents Drupal's 404 handler from kicking in and doing 
+# a full bootstrap when certain types of files are not found.
+# This can save server and bandwidth resources.
+# Note, that this does not apply to any files located in the files/.
+<FilesMatch "\.(png|gif|s?html|jpe?g|css|js|cgi|ico|swf|flv)$">
+  <FilesMatch "^([^/]|/(?!files/))+">
+    ErrorDocument 404 default
+  </FilesMatch>
+</FilesMatch>
+
 # Set the default handler.
 DirectoryIndex index.php
 
@@ -82,6 +92,8 @@
   #RewriteRule module.php index.php?q=%1 [L]
 
   # Rewrite current-style URLs of the form 'index.php?q=x'.
+  RewriteCond %{REQUEST_URI} !\.(png|gif|s?html|jpe?g|css|js|cgi|ico|swf|flv)$ [OR]
+  RewriteCond %{REQUEST_URI} ([^/]|/(?!files/))+
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
