Creating a custom 404 error page with cPanel takes only a few minutes. In this tutorial I will show you the quick way to get a custom 404 page onto your site by using cPanel's inbuilt functions, and will also show you how to create a static custom 404 for Mambo that looks like the rest of your site.
cPanel Error Pages
Login to your server's cPanel administration area. Locate the Error Pages icon and click.
A screen similar to this will load: 
Select the 404 (Wrong Page) option. This will open a basic plain text editor into which you type your content.
At the top of the editor textfield box cPanel gives you some suggestions for code that you can include on the page. You can include information such as:
Referring URL - <!--#echo var="HTTP_REFERER" -->
Visitor's IP address - <!--#echo var="REMOTE_ADDR" -->
Requested URL - <!--#echo var="REQUEST_URI" -->
Server Name - <!--#echo var="HTTP_HOST" -->
Visitor's Browser - <!--#echo var="HTTP_USER_AGENT" -->
Redirect Status Code - <!--#echo var="REDIRECT_STATUS" -->
If you want to have a simple, quick and easy custom 404 page all you need to do is enter one or more of these variables, and perhaps some basic HTML such as a header or a paragraph with suggestions for what the visitor should do next. You can also add links back to your home page or a search box if you wish.
Save, and enter an invalid URL for your site to see your new custom 404 error page.
Most people don't want such a basic, unstyled page on their Mambo or Joomla! web sites. In my earlier tutorial I explained how to create a custom 404 error page for Mambo using Mambo itself. On a very busy site, especially one that receives a lot of 404 errors, you may wish to keep server load low so creating a Mambo page for your 404 may not be what you want.
Creating a Static 404 Page That Looks Like Your Site
Creating a static 404 error page that looks like your Mambo site and uses the same headers, footer, and images is not difficult, even for the HTML and CSS challenged.
The first thing we do is we load up our site in our browser. Choose the shortest and simplest page on your site. Then, in the browser source view, select all and copy/paste this into either a plain text editor or into your favourite HTML editing tool.
Open the file you have just created and locate the mainbody content. This is the content we are going to replace. For our static page, we will remove everything that is generated by Mambo's <?php mosMainBody(); ?> and remove all code associated with modules within our page (there is no point leaving code for search boxes or other content that cannot work outside of Mambo itself).
If you are using the default Mambo template, look for the code that start with this: <!-- start main body --> <div id="content_main"> and remove everything between these lines and this: </div> <!-- end main body -->. We want to keep the opening and closing div so that our 404 page content is styled the same way as our Mambo template.
Now, add your own 404 page content between <div id="content_main"> (or whatever your own mosMainBody content container may be) and </div>. You can use the variables I mentioned above, and you can add as much HTML code as you wish. Read the earlier tutorial for tips on what to include in your custom 404 page content.
NOTE: 404 error pages can be called from anywhere within your web site, so all links to URL's and images must be absolute links.
When you have added your content, view the page in your browser to test that everything works. If it works from your local computer it will work on your site.
Now we go back to cPanel. Login and go to your File Manager. Look for the file called 404.shtml.

Click to select.
On the top right of the screen you will see the following options. Select Edit File. 
When the basic editor opens, delete everything in the file then copy/paste everything from the static page you created. Save, then test by going to your site and entering an invalid URL.
This method can be used with any dynamic CMS and I have been successfully using it on Mambo and Joomla! web sites for years. There is no additional server load when using this method. The only downside is that when you change your template you do need to update the 404.shtml file if you want it to continue to look the same as your site.
Examples of 404 Pages for Mambo
- On the Mambo News portal I created a 404 error page within Mambo. You can see it here.
Read the create a custom 404 error page for Mambo tutorial for information about how to do this. - On the Mambo Support site I created a static 404.shtml using the method outlined above. Here it is.
For web sites using Microsoft's IIS, read this tutorial about using a custom error page with IIS.
If you enjoyed this post, make sure you subscribe to my RSS feed!














{ 2 comments… read them below or jump to the comment form to add your thoughts }
Thank you,
This was very very good. I have no schooling. I am completely self taught and it is very rare to find help that is so easy to understand. I will sign up for your feed right now and I will be referring back often. Just one thing I ask,
Keep it simple: )
Thanks Again,
Rita B
Thank you
I really appreciate the screenshots provided with your step by step directions to creating customized 404 error pages using cPanel.
I was never sure how to do this and your post has clarified it for me.
Leave a Comment