custom 404 error article pages |
|
Do you hate it when you have broken links on your site or that dreaded error page with the 404 message appears and it looks nothing like your website?Well, today you're going to learn how you can change all that by simply editing one piece of code in your Joomla site . I'm going to share with you my own error page and I'll highlight the code below you need to change in order to customize your 404 page.But before we start doing this, you need to create an article in the article manager. Call it whatever you want and put in whatever message you want your visitors to see when they come across the broken link / error page.
Make sure you publish it the the Uncategorized section and category.Once you've done that - download my own error page (linked below) and then change the following code in the file you've just downloaded: /* Custom Error Page Mod Code */ if (($this->error->code) == '404') { echo file_get_contents('PUT URL FOR YOUR NEWLY CREATED ERROR ARTICLE HERE'); } else { Ok, we've nearly finished. Once you've done the amendment in the file, upload this amended file to the following folder in your joomla site:templates/system/ It's as simple as that - you're all done. to test out the error page - just do what you tried to do on my site and see if your custom error page works! |