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
Edit domains and sitemaps
Apr 4, 2025
By myq.

How to create a sitemap when using an edit domain

Customize the default page title
Mar 12, 2025

Change the default " :: " and/or "site name :: page title" formatting separator to something else.

Configure Composer to work with a Page Type
Feb 20, 2025
By myq.

Fix the "Unable to load block into composer. You must edit this content from within the context of the page." error message

Permissions for editors in a multilingual site
Feb 2, 2025
By myq.

How to set up a multilingual Concrete CMS site for groups of language-specific editors

Restoring deleted pages using advanced search
Jan 16, 2025
By myq.

How to recover deleted pages when there are more than a few to choose from.

How to Automate the Copyright Year
Dec 27, 2024

Learn how to keep your website's copyright year updated automatically in Concrete CMS.

Improvements?

Let us know by posting here.