404 Page

A 404 error is automatically triggered when a visitor navigates to a non-existent or incorrect URL.

Template

The 404 page template must be named pages-404.phtml and placed in your current theme directory.

The $page entity is part of the Pages module and supports the same methods.

The following snippet is an example of a 404 template:

<section class="py-5">
    <div class="container py-5 my-5">
        <h1 class="mb-3">404: <?= $page->getName(); ?></h1>
        <p><?= $page->getContent(); ?></p>
    </div>
</section>

Table of Contents