Custom error page for 404 page not found. This worked for me with Joomla 3.9.1

1) Below is the code for an error.php file which goes in /public_html/templates/your_template i.e. root of default template

error php code

 

2) Create an article named 404 (with alias 404) in category Uncategorised. Make it No index, no follow and publish it. In this article suggest to your visitor what they may do e.g. go to the home page, or search the site using your site search facility. The name of the article can be whatever you want, I have used 404 as an example.

 

3) Create a Menu item called 404 with alias of 404, again use whatever name you want. Menu Item Type is a single article and select the article as created in 2) above.

 

menu item 404

 4)  Go to the Link Type tab and set Display in Menu to No which will hide this menu item as of course no one wishes to to see this in the normal course of events.

 

make menu hidden

 5) Back in the Menu list this item should now show as hidden.

menu item hidden