Create A Custom 404 Page - Question | JoomShaper

Create A Custom 404 Page

JH

Jeff Honeyager

Template 3 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.

0
4 Answers
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 3 years ago #15147

Hello Jeff Honeyager

Please follow this blog

Best regards

0
JH
Jeff Honeyager
Accepted Answer
3 years ago #15228

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?

0
JH
Jeff Honeyager
Accepted Answer
3 years ago #15276

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; }

0
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 3 years ago #15301

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

0