Xavier What we have to say on Twitter
Xavier Xavier

Xavier Media®

 line

  Subscribe by email Subscribe via email

  Feed link Subscribe via RSS
  What is RSS? What is RSS?

  MyXavier Follow @XavierMedia

  Twitter Follow @XavierMedia

  Facebook Our Facebook page

XavierMedia.com

Webmaster Tools

Keywords

RSS iPhone and iPad stuff – Most Useful Things

How to setup custom error pages

December 10th, 2008 by Andreas from Xavier Media® in Tutorials. Topics: ,

I guess you've all seen the standard error pages most web servers show when for example a page can't be found. If you haven't seen them before then you can't have been using the Internet for logn :D , but if you've seen a couple of them you know that they aren't that nice and not at all helpful.

The most common error page is the 404 Page not found error page and the standard error page is not at all helpful for a visitor. In most cases when a visitor see the standard page you'll lose a visitor since the will simply just hit the back button immediately. By setting up a custom page not found error page you can help your visitors to find what they are looking for or maybe interest them in some other part of your web site. You get at least a bigger chance with a custom error page…..

To do this you need a Unix or Linus based web server with Apache (most web servers are, but if you're hosted on Windows or something else you can switch to eXavier.com and get 10% off by using coupon code RS08Host).

Create a new directory in your public HTML folder (i.e. where all your public web pages are located) called something like /errorpages/ and create the error page you want your visitors to see. You can name the pages like 404.html for page not found errors, 403.html for access forbidden pages etc. If you're using .php pages on your web site you can of course name your error pages 404.php instead.

New text file called .htaccess in a text editor like wordpad or notes (don't forget the dot before the file name) and add the following text in it:

ErrorDocument 404 /errorpages/404.html

If you already got a .htaccess file in your public HTML directory then you should edit that one since it may contain important information, in that case just add the line(s) at the end of the file.

"ErrorDocument" will tell the server that it's an error document you're defining and the numbers after will tell the server which kind of error. You can have as many error documents as you like as long as you make sure you don't add the same error code twice. There are a couple of different error codes and some of the more common once are:

404 – Page not found
403
– Access forbidden, if you got a password protected page and someone enters the wrong password.
401
- Unauthorized, similar to the above code.
500
– Internal server error, when one of your scripts fail to deliver what it's supposed to deliver.

When you've created all error pages and filled in all of them on a separate line in your .htaccess file you just upload everything to your server. If you've done it correctly you should start seeing your error pages.

You can test your 404 page by visiting something like www.sampleaddress.com/lahdjkhafjksfhjashdf (i.e. a directory you know doesn't exist on your server).

About the author
Andreas co-founded Xavier Media® in 1996 and has since been involved in all kinds of development, marketing and making money online.

 

You may also be interested in...
How to make money from missing pages
How many pages are there on the Internet today?
Cryo PC – custom built pcs

Subscribe to new posts from this blog

Leave a Reply

Powered by WP Status.net plugin.

RSS XavierMedia.org

RSS Easy PLR

 line
 line  line
 line © Copyright 1996-2012 Xavier Media®. All rights reservered.
Contact us | Support/help | Privacy Policy | Company Info
The World According to Xavier | Domain Names