404 error: Creating a custom error page

Custom 404 error page

Example of a custom error page

By default, Drupal generates a fairly simple 404 error page. If you wish to modify what appears on this page, follow the steps below.

Prerequisites

For the purpose of this tutorial, you will need to have webmaster-level access or higher.

  

  

  

  

 

  

Step 1 – Create a custom 404 error page

The first step is to create a completely new page that will serve as the error page of your website. This can either be a node, such as a Basic Page, or a custom Panel Page.


For the purpose of this tutorial, we will use a Basic Page:

  1. From the administrative toolbar, navigate to Content.
  2. At the top-left of the page, click on Add content.
  3. From the list, select Basic Page and then fill out the title and the body fields as you please. For example:
    • English title: 404 error | Page not found
    • French Title: Erreur 404 | Page introuvable
    • English content: Sorry, the page you were looking for could not be found.
    • French content: Désolé. La page demandée ne semble pas exister.
  4. Once done, enter a revision log message and save your changes.

Step 2 – Define your error page in the site configuration settings

  1. From the administrative menu, navigate to Configuration.
  2. Under the section System, go to Site information.
  3. Scroll to the bottom of the page until you find the Error Pages section. In the field Default 404 (not found) page, enter the relative path of your page.
  4. Once done, click on the button Save configuration.
» Submit feedback
    Types: 
  • Tutorials
Back to top