Drupal's 404 response is very resource intensive as it causes Drupal to fully bootstrap.
Drupal core has an option to serve a simple static HTML error response to a 404 status code. Enabling this setting can decrease wasted bandwidth and server load.
The instructions differ for Drupal 7 and Drupal 8. Follow the instructions that correspond to the Drupal version in use in your application.
The Fast 404 contributed module does extend the current functionality of Drupal 8 core, however it's not necessary to create a static 404 HTML page. To implement a Drupal 8+ default core 404 static HTML response your team will need to edit the settings.php in Drupal and look for the following configuration.
/**
* 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:
* - $config['system.performance']['fast_404']['exclude_paths']: A regular
* expression to match paths to exclude, such as images generated by image
* styles, or dynamically-resized images. The default pattern provided below
* also excludes the private file system. If you need to add more paths, you
* can add '|path' to the expression.
* - $config['system.performance']['fast_404']['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.
* - $config['system.performance']['fast_404']['html']: The html to return for
* simple 404 pages.
*
* Remove the leading hash signs if you would like to alter this functionality.
*/
# $config['system.performance']['fast_404']['exclude_paths'] = '/\/(?:styles)|(?:system\/files)\//';
# $config['system.performance']['fast_404']['paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
# $config['system.performance']['fast_404']['html'] = '
.....
settings.php
file# drupal_fast_404();
settings.php
fileDrupal core's fast 404 option avoids expensive page rendering without the need for an additional module. However, the Fast 404 module improves on this core functionality with more options to reduce load caused by bad requests.
The instructions differ for Drupal 7 and Drupal 8. Follow the instructions that correspond to the Drupal version in use in your application.
sites/all/modules
)README.TXT
file into your settings.php
filesites/all/modules
, modify the include_once path to match the install locationsettings.php
file to your repositoryTo maximize the effectiveness of the Fast 404 module it may be necessary to familiarize yourself with each configuration setting found within the code block of the README.TXT
file to determine whether it fits your needs.
By default, Drupal fully bootstraps for every 404 Not Found. This can be very expensive resource intensive; not just for missing pages, but any page with a bad link or a missing files can generate several 404s with one page request which can multiply the amount of resources needed to serve a single page.
Ideally, it would be best to eliminate all 404 requests; however, there are times when this is not a tenable option, such as developer resource constraints or a traffic spike. Thankfully, there are several methods to eliminate a fully bootstrapped response to a 404 Not Found request.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Wed Oct 22 2025 08:59:29 GMT+0000 (Coordinated Universal Time)