101 Web Template

VIEW CART : CHECKOUT
SUPPORT

REGISTER TODAY!
SIGN IN

Resources Site Map

Business Web Templates : PayPal Web Templates : Portal Web Templates : Misc. Web Templates

PayPal Web Template 025
$34.99

  1. PayPal Web Template 001
  2. Portal Web Template 018
  3. Business Web Template 036
  4. Portal Web Template 008
  5. Business Web Template 052

FAQs

Support

Terms of Use

Advanced Search

Template RSS Feed

Top » 101 Web Template » Client Side Coding » Creating custom error pages using .htaccess

Website Templates : Web Templates : Photoshop Templates

101 Web Template - Your Template Solution

Creating custom error pages using .htaccess

Creating custom error pages using .htaccess

No doubt you've been frustrated after visiting a web site, then clicking on a link only to be presented with the dreaded :

Error 404 - File not found

What's the first thing you do? In most instances I know I just leave the site altogether.

Lost visitor = lost $$

But in the instance that there is a properly structured custom error page, especially if it has a search box, I may hang around a while longer - or another offer may grab my attention.

If your web host supports .htaccess files, then with a few minutes work, you can have your own error pages up and running!

What is a .htaccess file?

It basically contains commands that instruct the server how to treat certain requests.

The .htaccess file contains a number of settings to control who can access the contents of a specific directory and how much access they have. It can also be used to create a "URL Redirect".

How do I implement custom error pages?

Create and publish what will be your custom error pages to your account as you would usually publish any page. You'll need to create two for the more common error codes, file not found (404) or unauthorized/forbidden (403, 401). Your custom error pages should have an apology, a brief blurb regarding what may have gone wrong (file renamed etc.). This explanation should be immediately followed by an invitation for the visitor to try reloading the page or to select a different section (provide suggestions). Ensure that these pages have your sites' look and feel.

After publishing the pages, you'll need to edit the .htaccess file in the root of your document directory of your site. Use the Edit utility (set to ASCII transfer mode) in your FTP software to view the file (it would be wise to also create a backup).

If you have a FrontPage web, be especially cautious, as the .htaccess file contains other important FrontPage configurations.

If you don't find a .htaccess file in the root of /docs, you can create your own with any text editor - ensure the file is called .htaccess (include the dot)

Add the following lines to the end of the file (change to suit)

ErrorDocument 404 http://blah/blah/404.htm
ErrorDocument 403 http://blah/blah/403.htm
ErrorDocument 401 http://blah/blah/401.htm

Save the file, test by trying to access a page that doesn't exist on your site - done!

Custom error pages are very easy to create and help you to retain wayward visitors - remember, that one visitor you may lose through not having custom error pages may be the one who was ready to buy your products.

What if I'm renaming or moving pages?

While you can use a custom error page in these situations, it's better to use a 301 redirect for a number of reasons. Learn why and how to implement a 301 redirect in our tutorial:

http://www.thinkhost.com/services/kb/301-redirect.shtml

Michael Bloch
Team ThinkHost
http://www.thinkhost.com

ThinkHost is an international web hosting company offering reliable and well supported FrontPage, PHP and MySQL hosting services, plus a wide range of related resources for their clients. This article is copyright (C) 2003 and cannot be reproduced without express written permission from ThinkHost.

Affiliate Programs

Getting Started

Design and Layout

Client Side Coding

Server Side Coding

eCommerce

Marketing

All Webmaster Articles

Free PayPal Template

Webmaster Resources

101 Web Template RSS Feed

Free Templates

Templates Box

Free Web Templates

4 Layouts

Template Monster

Template Blog

Business : PayPal : Portal : Misc.
Support : Webmaster Resources : Top Site : Articles : Site Map : Web Hosting

© 2002-2010 101 Web Template, All Rights Reserved.
Designed by Graphic Web Design | Hosting by Las Vegas Web Hosting