This article is going to teach you how to create a custom Joomla 404 page in under 5 minutes.

Check out this video for a step by step guide or read below

Step 1: Create your Joomla 404 page

To create your Joomla 404 page, you first need to create a menu item for the page.

Begin by logging into Joomla at yourwebsite.com/administrator

Once you’re logged in, click on “Menus” in the top navigation bar and select your main menu.

Once your main menu loads up, you’ll see a big green button on the left that says “New” – click on that.

Simply title the menu item “404 – Page Not Found” and then click on the blue “Select” button next to where it says “Menu Item Type *”.

This will load up a pop up box. Select “Articles” and then “Single Articles”.

This will close the pop up box and give you a new input field underneath Menu Item Type that says “Select Article *”. Click on the “Create” button next to that.

Now we are creating the article that will hold the contents of our 404 page. So title it “404 – Page Not Found” and add in some content into the WYSIWYG editor. For example, you could add in something like the below:

Sorry, the page you are looking for cannot be found

But wait, why not call us on [PHONE NUMBER] to get the information you’re looking for directly?

Now click “Save & Close”. This will close the pop up box and save your article.

You have now created your 404 page. But there’s a few more settings we need to add in before it’s ready for use.

Hide the 404 page from the main menu

We next want to click on the “Link Type” tab in the menu item. This will give us a few options, but the one we want to pay attention to is the “Display in Menu” option.

Make sure we set the “Display in Menu” option to “No”

Stop search engines from indexing your Joomla 404 page

You then want to click on the “Metadata” tab for the Joomla 404 menu item we just created and scroll to the drop down that says “Robots”, and select the “No index, no follow” option.

Click the green save button, but don’t close this page (we’ll need it later!)

Step 2: Edit Your Joomla error.php File

We now need to edit one of your websites template files.

Open your website in an FTP client like Filezilla and navigate to /public_html/joomla/templates/YourTemplate

Inside your template you may find an existing error.php file. If you do, rename it to “errorold.php” and create a new file called “error.php”.

This allows us to roll back to your old error file if it was doing anything important.

Inside your new “error.php” file, add the following code:

<?php 
 defined( '_JEXEC' ) or die( 'Restricted access');
  if ($this->error->getCode() == '404') { header('Location: /linkFromMenuItem'); exit; } ?>

Now go back to the menu item we just created in Joomla and click on the “Details” tab.

Copy everything it says in the “Link” field.

Go back to our new error.php file and replace where it says “linkFromMenuItem” with the link you just copied from the link field above.

Save the file.

Lastly, visit your website at a URL that doesn’t exist – i.e yourwebsite.com/hjbgvgf

And there you have it – a brand new, super awesome custom Joomla 404 page created in under 5 minutes.

Do You Need Help From A Team Of Joomla Experts?

If you’d like a team of Joomla experts to help you with your website – get it touch with us today. We have been working in Joomla for over 10 years and know the CMS like the back of our hands! So call us today on 01206 864441 to get a free quote on your Joomla project.

Share On Social Media