Drupal handles 404 error pages, but on localhost that can be very annoying, especially if you have missing assets (such as uploaded images). For each image, CSS and such that is not found, a drupal is bootstrapped and ran.

How can one best disable this?

Removing the line ErrorDocument 404 /index.php from .htaccess gives no change. Should that work?

Changing it to ErrorDocument 404 "development not found" does not work either.

1 Answer 1


Newer versions of Drupal have an addition to settings.php so that it doesn't handle the 404 for certain assets:

$conf['404_fast_paths_exclude'] = '/\/(?:styles)\//';
$conf['404_fast_paths'] = '/\.(?:txt|png|gif|jpeg|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
$conf['404_fast_html'] = '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>';

There are comments in the file that explain these new options some more.

You can also edit the .htaccess to disable the ErrorDocument and then put some ErrorCond directives in to prevent missing files from being punted to index.php:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !files/foo/(.*)\.bar$
RewriteRule ^ index.php [L]
  • This is mostly for versions<7. I will update the OP to explain that. Thank you for the explanation. The RewriteCond %{REQUEST_URI} !files/foo/ was the one breaking the 404 setting.
    – berkes
    Commented Jun 13, 2012 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.