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