Using Static 404 Module

The Static 404 module is a very basic module. It allows you to generate and store a static version of a 404 page by clicking on the “Generate static 404 page” button in the “Site information” page or via a Drush command. For this module to work you need to define a node as your 404 page.

In this tutorial, I’ll show you how to setup the Static 404 module.

Getting Started

Download and install the Static 404 module.

Configure Static 404

First of all we need to create a basic page that will be our custom 404 page. We’ll configure the page to be served as the 404 and then Static 404 module will generate a static version of the page and store it in the files directory.

1. Go to Content -> “Add content” and create a custom page for the 404 error.

2. Go to Configuration -> “Site information” (admin/config/system/site-information).

3. Scroll down to the “Default 404 (not found) page” field and enter in the URL to the custom “not found” node. The URL should be something like node/1.

4. Don’t click on the “Generate static 404 page” button yet, first click on the “Save configuration” button.

Fig 1.0

5. Now click on the “Generate static 404 page” button.

If everything worked, you should see a successful message.

Fig 1.1

The generated static page is stored in the files/404 directory.

Drush Integration

The module integrates with Drush so you can regenerate the static pages with a simple Drush command. Just run the following command:

$ drush static_404_generate

If you have any questions, please leave a comment.

2 thoughts on “Using Static 404 Module”

  1. Fast 404 is another good one to look at. With that one the performance is almost as good and you don’t have to worry about re-generating the 404 page. Plus it’s the approach that’s being taken w/ D8 and was partially implemented in D7.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top