How to create a 404 page - Page Not Found

This tutorial is over a year old and may not apply to your version of Concrete CMS.
Apr 29, 2016

Creating an Error 404 Page

If your Theme does not include a file named page_not_found.php, you can create your own.

Create a page_not_found.php

Upload the file to application/themes/CustomThemeFolder (or where your theme is)

Then add the following

<?php
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php'); ?>

<main>
    <div class="container">
        <div class="row">
            <div class="col-sm-9 col-sm-offset-3">
                <div class="jumbo">
                    <h1><?php echo t('404 Error')?></h1>
                    <p><?php echo t('Page not found.')?></p>
                </div>
            </div>
        </div>
    </div>
</main>

<?php  $this->inc('elements/footer.php'); ?>

If you want to make your 404 page editable with a search, use the following instead.


<?php defined('C5_EXECUTE') or die("Access Denied."); $this->inc('inc/header.php'); ?> <div id="main-content" class="main-container"> <div class="main-content-inner clearfix"> <main role="main"> <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-offset-2"> <main role="main"> <article> <?php $a = new Area('Main'); $a->enableGridContainer(); $a->display($c); ?> </article> </main> <div class="jumbo"> <h1><?php echo t('404 Error')?></h1> <p><?php echo t('Page not found, so please search.')?></p> <?php $bt = BlockType::getByHandle('search'); $bt->controller->title = t('Search'); $bt->controller->buttonText = t('Search'); $bt->render(); ?> </div> </div> </div> </div> </main> </div> </div> <?php $this->inc('inc/footer.php'); ?>

Find out how to optimize you 404 error page.

Recent Tutorials
Upgrading Concrete from 8.5 to 9.x
Jun 21, 2024
By myq.

How to avoid problems upgrading from 8.5 to 9.x

How to change the default date format
May 30, 2024
By myq.

Change the format of the default date

WebOps Tutorial on Running and Upgrading a Concrete CMS Website
May 2, 2024
By myq.

Describes how to deploy, manage, and upgrade a Concrete CMS website

Using the Concrete Migration Tool Addon
Apr 27, 2024

How to use the Concrete CMS Migration Tool

Create custom Site Health tasks
Apr 19, 2024
By myq.

This tutorial will guide you through the creation of a new Site Health task

Reusing the same Express entity in multiple associations
Apr 11, 2024
By myq.

How to create and manage multiple associations in Express

Improvements?

Let us know by posting here.