How to create a 404 page - Page Not Found

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
Add-On Developers: Get Your Add-Ons Ready for Concrete CMS 9.0
Aug 6, 2021
By andrew.

Concrete CMS 9.0 is coming! But there are some changes in version 9 that might affected your add-ons and themes. This document aims to answer questions about the most common ways that your add-ons might need to be changed, and common problems you'll run into.

Permissions for editors in a multilingual site
Jun 2, 2021
By myq_1.

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

Getting Started with Doctrine in Concrete CMS
Jan 20, 2021
By linuxoid.

Doctrine is a very flexible, simple (once you get to know it better) and powerful PHP library for database interactions primarily focused on the ORM = Object Relational Mapping and DBAL = DataBase Abstraction Layer.

How To Upgrade PHP Using the MultiPHP Manager In cPanel
Nov 23, 2020

This article will explain how to upgrade your PHP version using cPanel.

How To Add Google Analytics To Your Website - The easy way
Oct 9, 2020

Adding analytics to your website is an important part of running your website. There’s no need to edit your theme or install a plugin to add a tracking code to Concrete CMS you can do it right from the CMS.

How to Generate Sitemap xml File
Oct 9, 2020

Learn how to create a sitemap.xml in a couple clicks

Was this information useful?
Thank you for your feedback.