Error pages are web pages being served to the visitor when a problem occurs. These errors are identified by a numeric value usually from 400 to 500. The most well-known errors are probably “404 – Not Found” and “500 – Internal Server Error”.
Usually the default error pages simply display some basic information regarding the error that occured. But did you know that you can customize this? What if you could not only give it the look and feel of your website but also give the visitors some useful information to help them find what he wants?
There are various things you can do with error pages like logging detailed error information in a database, passing some data to a local search engine to help the visitor find what he’s looking for, etc. For instance, if a Google search result led to a 404 page on your website, you could grab the keywords searched and suggest related content to the visitor.
Most web control panels allow you to customize your website’s error pages but today we’ll focus on doing this with cPanel.
First start by clicking on the Error Pages icon from the Advanced panel (assuming you’re already logged in cPanel of course).

Next you will be prompted to select for which domain you want to modify the error pages. Select it and hit the Go button.
You must now select which error page you want to customize:
For this tutorial, we’ll create a custom 404 error page since this error is probably the easiest one to provoke.
Note: if you are using a Wordpress blog, creating a custom 404 error has no effect since all requests made to the web server are parsed by Wordpress. Therefore, the 404 page are generated by the blog software itself. There might be some other web applications that behave like this too.
Click on the 404 link to create a custom error page. You will be brought with an online editor (a very basic editor, that is) to help you create your custom page. There are some buttons at the top what will help you insert some dynamic information.
Let’s create an error page with this content for example:
<p>Oops! The page you have requested cannot be found.</p> <ul> <li>Requested URL: <!--#echo var="REQUEST_URI" --></li> <li>Your IP address: <!--#echo var="REMOTE_ADDR" --></li> </ul>
Now save this file as 404.shtml and click on the Save button at the very bottom. Open your web browser to a web page that doesn’t exist on your website and you should get something like this:

You could also have saved the file with the .php extension so that it would’ve been processed as a PHP script but more on this in a future post!
Links
Posted in Control Panels · Tutorials | 2 Comments
2 responses so far ↓
1. Response by : Anthony Damasco on Jul 23, 2008 at 2:48 pm
Thanks man, I never got around to learning this, do you know how to do it in plesk?
2. Response by : Stephane Brault on Jul 23, 2008 at 3:14 pm
Hi Anthony,
I will post a series of tutorials on Plesk very soon. Subscribe to my RSS feed to be notified.
http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1480074
In fact, you more or less need a control panel to do this. Custom error pages can be specified in .htaccess (this is for Linux hosting of course).
http://www.thesitewizard.com/archive/custom404.shtml
Leave a Comment