Tuesday, November 5, 2024

The Secret of Custom Error Pages

Just about every website has a broken link here or there that no longer connects to the page specified in the URL.

These broken links loose you visitors and cost you money.

Often what happens is you delete or move a page, and then forget to update some of the other pages on your site that link to it, or other sites such as search engines still display links to the old URL.

When a surfer clicks on one of these links, the server runs off to grab the page as usual, but on finding nothing there sends a “page not found” server error 404 to the Web browser.

Why The Standard Solution Sucks

A server’s standard error page is plain ugly. But worse than that it leaves the surfer stranded at a dead-end. Their only options are to hit the back button, or close the window.

You’ve just lost a potential customer!

But it doesn’t have to be that way …

Creating Custom Error Pages

Many web hosts now offer the option of creating your own custom error pages for this and other common server errors through a simple online control panel. If your host provides this function, take advantage of it right away.

All it involves is selecting another page of your own design that the server will look for when there is an error, instead of displaying its standard error page.

We’ll go into the details of what you might want to put on this page later.

For now, just log-in to your website’s online file manager and make a copy of your site index file, saving it as “404.html” in the same directory (or copy the file on your PC and then upload it).

In your control panel options, look for “error pages” and choose 404.html as the file to be displayed whenever a requested page cannot be found. (You could just select your existing index.html as the error page, but I suggest you make a new page – you’ll see why later).

Now every time a page isn’t found, instead of seeing the unhelpful error page, the surfer will automatically be sent to this copy of your homepage.

Making A Custom Error Page Manually

If you don’t have a control panel, you can set-up your error page manually. First of all, make a copy of your website homepage on your PC and save it as “404.html”.

Next you need to create or edit a special file named “.htaccess” stored in your site’s root directory.

Log-in to your server via FTP and check if there is already a .htaccess file in your root directory (where all your web pages and folders are, e.g., “www” or “html_docs”).

You may need to adjust the settings of your FTP software so that it shows you hidden files on the server (i.e., those that begin with a period, “.”), so you don’t accidentally overwrite an existing .htaccess file, deleting its contents.

Beware: overwriting an existing .htaccess file could make your website inaccessible! Although seldom the case, your host may have put some critical information inside.

Likewise, if there is already a .htaccess file there, do NOT delete it. Download it to your PC, make a back-up copy, and then open it in a plain text editor (like Notepad). Add the following command on a new line below whatever else is in the file and then save it:

ErrorDocument 404 /404.html

This tells the server to show “404.html” as its error page (what the control panel does is automatically add this line to the file for you).

If there isn’t already a .htaccess there, create a new plain text file on your PC and paste the above into it. Save the file as “htaccess” (or “.htaccess” if your PC displays file names that start with a period).

FTP both this file and the 404.html page you just saved to your website root. If you upload the file as “htaccess” you will need to use your FTP software to rename it as “.htaccess” on the server.

Now you have created your custom error page, test it by typing an URL to a page on your site with a mistake in it. You should be instantly redirected to your new 404.html page.

If you get a server error, it means you’ve made a mistake in your .htaccess file. Revert to your backup copy and then check to make sure you’ve not added any characters or spaces that shouldn’t be there.

Once you have this working, you can use the same method to create custom pages for other server errors. These are the most common, with the relevant .htaccess commands in brackets:

(ErrorDocument 405 /405.html)
(ErrorDocument 404 /404.html)
(ErrorDocument 403 /403.html)
(ErrorDocument 401 /401.html)

In part two of this article, I’ll be showing you how you can get more from your custom error pages, plus revealing secret ways you can actually PROFIT from them! There’s a ton of great stuff covered, so don’t miss it.

Online since 1998, Azam Corry helps marketers succeed. Get Free Guides, Tools & Web Marketing Resources at: http://NowSell.com/?a

Speed profits with resale rights ebooks & packages: http://eBookSaver.com/?a

==> SPECIAL FROM AZAM:Subscribe Now to Biz Bits eZine & get my Big info-packed eCourse PLUS real-value ebooks 100% FREE! Just BizBits@NowSell.com

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles