Hunter Network . Free Templates . Free Graphics . Web Hosting Directory . Top Template Sites . Web Design Directory

Creating custom error pages using .htaccess

Hosting BlogWebmaster ResourcesHome

Main Menu
Home
Web Hosting Directory
Hosting Blog
More Webmaster Articles
Search
Site Index
Submit an Article
Webmaster Resources
Submit Hosting Company
Web Hosting Templates
Web Design Directory
Link to Us
Administrator
Partner Sites
Template Blog
Template Search Engine
Free Templates
Free Graphics
Free Web Templates
Top Template Sites
Las Vegas Web Hosting

Hosting Directories

$10 Cheap Web Hosting
Host Lead
Host Approval
Web Hosting ProCentral
Find My Host
Host Companies
Top 10 Web Hosting
Starter Plans
Low Cost Hosting
Hosting Directories.info
HostDirs.com
Website Hosting
Web Hosting
Web Hosting Reviews
Find Web Hosting Companies
Hosting - Review
Add Your Hosting Directory

Home arrow Hosting Blog arrow Webmaster Articles arrow Creating custom error pages using .htaccess

Creating custom error pages using .htaccess PDF Print E-mail

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.

 

WEB HOSTS: Reduce your support tickets by up to 50%!!!!! Add Flash Tutorials to your Help Desk.
cPanel Hosting only $6.99/mo.
Latest Articles

Most Popular

Web Hosting Directory

Who's Online

Great Hosting Offers

CPanel Hosting
Rock Solid Hosting as low as $6.99/mo. and FREE SET-UP

iPowerWeb Hosting Co.
Special Hosting Offer $7.95/mo and Free Setup

Yahoo! Small Business
Reliable web hosting from Yahoo!
Domain name included

Lunarpages.com
300MB of storage and 20GB of transfer for only $7.95

StartLogic
Free setup/domain, Web builder, unlimited emails, PHP, mySQL, CGI, FrontPage. From $6.50/month. Click Here for more info.

Our site hosted by

Las Vegas Web Hosting
Friendly service and great prices as low as $6.99/mo.

© 2002-2007 Web Hosting Hunter


Las Vegas Web Design
Las Vegas Web Hosting