To create a Joolmla 4 custom 404 page follows the steps below...
- Create an article called "404", style it the way you want the page to look including links.
- create a hidden menu with a menu item called "404" set the alias to "404"
- go to the 'link style" tab and turn off "Display in menu"
- go to the alias you just created like http://hallhome.us/404
- go to your template, then files then 'error.php' Put this code as shown in the image below.
- go to a silly url like http://hallhome.us/burp and verify you see the fancy 404 page you just created. If not, walk back thru these steps again.

/* Load Custom 404 article with true 404 error code returned */
if ($this->error->getCode() == '404') {
header("HTTP/1.0 404 Not Found");
echo file_get_contents(JURI::root().'/404');
exit;
}
if ($this->error->getCode() == '404') {
header("HTTP/1.0 404 Not Found");
echo file_get_contents(JURI::root().'/404');
exit;
}
To create a Joomla 3 custom 404 page do the following...
- Create an article called "404", style it the way you want the page to look including links.
- create a hidden menu with a menu item called "404", set your alias to the link you want to use. I recommend "404"
- go to "link type" tab and set "Display in menu" to off
- go to "metadata" tab and set it to "noindex,nofollow"
- go to cpanel and copy the error.php to your template root directory
- go to your template files and open the error.php we just copied a few steps ago.
- enter the rewrite code, as shown below, replacing "your-alias-here" with the alias we used when we created the menu item.
- go to your home page then put a silly url in like http://hallhome.us/burp
- If you get your 404 page congratulations your done. If not, go back thru these steps.
/* Load Custom 404 article with true 404 error code returned */
if (($this->error->getCode()) == '404') { header('Location: /your-alias-here'); exit; }
If you have SEF off then you'll need to follow the steps below...
- Create an article called "404", style it the way you want the page to look including links.
- create a hidden menu with a menu item called "404"
- on your menu, click the 404 menu item you just created.
- copy the link path shown in the url, such as...
index.php?option=com_content&view=article&id=44&Itemid=462
- go to cpanel and copy the error.php to your template root directory
- go to your template files and open the error.php we just copied.
- enter the rewrite code replacing "your-alias-here" with the link we just copied
- go to the 404 menu item and on "link type" turn off "display in menu"
- go to "metadata" and in the robots area choose "noindex,nofollow"
- go to your home page then put a silly url in like http://hallhome.us/burp
- If you get your 404 page congratulations your done. If not, go back thru these steps.