Create a custom 404 page - Forum | JoomShaper
Staff replied Templates

Create a custom 404 page

Asked by Jeff Honeyager 5 years ago Last activity 5 years ago

I've looked in the error.php file and I don't know what to do.

How/Where do I create a custom 404 page.

I searched the forum - no luck.

4 replies

Ofi Khan Staff

Hello Jeff Honeyager

Please follow this blog

Best regards

Jeff Honeyager Asked this

The link's instructions did not work.

SEF = yes
URL Rewriting = yes
Add suffix = no

I got the code displaying on the screen.

My "hidden menu" alias to the custom 404 page is:

what-were-you-looking-for

So what do I change?

Jeff Honeyager Asked this

This worked:

Given this global configuration:
SEF = yes
URL Rewriting = yes
Add suffix = no

  1. Create an Article

  2. Create Hidden Menu Item pointing to the Article Save - copy the menu alias - example: "what-were-you-looking-for"

  3. Modify error.php

Just after:

defined('JEXEC' or die;

Add this one line of code:

if (($this->error->getCode()) == '404') {header('Location: http://www.mydomain.org/what-were-you-looking-for');
exit;
}

Ofi Khan Staff

Thanks for your suggestions. I am glad that it worked.

Log in to reply.