2 Pages V  1 2 >  
Reply to this topicStart new topic
> Custom 404 Error Pages

Technical Administrator

Group Icon
Group: Technical Administrators
Joined: 3-February 03
Posts: 3,926
From: Sydney Australia
post Nov 9 2004, 12:04 AM
For those that don't know, whenever your server cannot find a page that matches the URL, it will return a 404 error, which means, basically, can't find that, sorry. This situation is really common, not just for sites that change coding languages / redesign, but just for links from external sites and human error.

I am not sure where this topic belongs, but in may ways, it is a usability issue. If users can't find what they are lookign for, your site has a usability problem. so many times, I get to a site expecting to find an answer, only to find the page is dead. Straight for the back button, they lost me.

Showing users a standard 404 page is just wasted traffic and, in many cases, traffic looking just for you. Why show them something useless?

Thankfully, all major servers allow one to create a custom 404 error page. On Apache, it is relatively trivial, and this article is a great tutorial.

So, what should a good 404 error page should do? IMHO, it should explain to the user what happenned, and provide them with multiple links to relevant sections of the site and perhaps a search box to loom for what they want.

There is no doubt in my mind that the best custom 404 page is Apple's, http://www.apple.com/great-404-page. Ot has the explanation,
QUOTE
Looking for something at Apple.com?
The page you tried was not found. You may have used an outdated link or may have typed the address (URL) incorrectly. You might find what you’re looking for in one of these areas:

followed by a series of links to the main "chucks" of the site. It even has a search box, should the links be inadequate.

It really is a pity that so many sites just show the default 404 error message, e.g. http://www.arnotts.com.au/asdasd, http://www.three.com.au/asdasdasd.

So, what can you do to improve your 404 page? Most I have seen can be improved, including the cre8 404 page, http://www.cre8asiteforums.com/asd, and it is a not a bad idea to look into it.
Offline Go to the top of the page

Star Member

Group Icon
Group: 1000 Post Club
Joined: 17-June 04
Posts: 1,760
From: Essex, UK
post Nov 9 2004, 03:11 AM
Had a custom 404 page online for ages. My host tells me what to call it (missing.html) and all I do is generaqte the page and ftp it to the site.

The only thing I discovered was you must use absolute links - If the page was missing then there is nothing to be relative to.

Some hosts also provide .htaccess support (http://www.javascriptkit.com/howto/htaccess.shtml) which if they do is even better. Apache provides excellent .htaccess support (http://httpd.apache.org/docs/howto/htaccess.html.

Bye for now
Offline Go to the top of the page

Founder & Administrator

Group Icon
Group: Admin - Top Level
Joined: 29-August 02
Posts: 11,643
From: Bucks County, PA
post Nov 9 2004, 10:02 AM
Great topic!

I'm all for attempts at keeping one's visitor on the site if at all possible. In addition to the Apple example above (which is a little busy, but offers many choices), the same school of thought can be applied to form returns, shopping cart confirmations, email to a friend thank you's, newsletter subscription sign ups, etc.

What I do with my own form returns and order confirmations is to direct my visitors back into my sites. In my case, and likely not the best thing to do but it's free, I use the same forms on both the Cre8pc and UsabilityEffect sites. This means that the confirmation and thank you pages offer choices to BOTH of those sites, and my blog too.

It's one last ditch effort to keep them interested and coming back into the site after they've finished a task.

I enjoy it when custom 404 pages are worded warmly, and even funny. Basically we're saying "Hey! Don't leave! I haven't shown you the bathroom tile or the new lawn mower out the garage yet." 8)
Offline Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 11-February 04
Posts: 5,892
From: Los Angeles, CA
post Nov 9 2004, 11:04 AM
Great topic. Pages get moved and deleted all the time. On my site, I have thousands of new pages, but conversely, also remove thousands of old pages (discontinued products) each quarter.

They're on your site anyway. Do everything you can to get that second click. smile.gif

Here's mine.
http://www.respree.com/invalidurl
Offline Go to the top of the page

Lead Technical Administrator

Group Icon
Group: Admin - Top Level
Joined: 23-January 03
Posts: 1,995
From: Michigan USA
post Nov 9 2004, 11:27 AM
Coincidentally, I hit a 404 just yesterday that drove me a bit bonkers.

In one of our copywriting threads, there was a book mentioned that I happened to have on my shelf. I vaguely remembered the authors mentioning a software tool on their site that would have been a useful reference in my response, so I typed in the URL they offered.

Their first mistake, in my opinion, was in not telling me I had a problem. Instead of designing a custom 404 page, they had simply redirected all 404 errors to their site map. There was nothing on that page to indicate an error, nor was it even labeled as a site map, so I spent about ten minutes futilely looking for my software tool.

I found their second mistake when I tried to click off the page, and yea, I'm a bit slow witted, because that's when I finally realized what was happening to me. The URL in the Location bar was exactly what I had typed, which is what you expect when you hit a valid page -- but is also what happens when you hit a 404 page. I could have typed in ANY path on that domain and ended up at the same page. More importantly, the server actually treats the page as if it really exists at whatever bogus URL has been entered. As Fisicx remarked, that plays havoc with relative links.

Every single navigational link on the page pointed into the nonexistent folder I had tried to enter. I couldn't get anywhere on their site without manually editing the URL. Needless to say, I didn't bother. sad.gif
Online Go to the top of the page

Moderator

Group Icon
Group: Moderators
Joined: 29-August 02
Posts: 5,751
From: Bristol, UK
post Nov 9 2004, 12:48 PM
Ian Lloyd wrote quite a good article on this for AListApart earlier this year.

The Perfect 404 gives some pointers in creating friendly 404's and some rudimentary distuinguishing between different 'types' of 404.

One of those things I kept meaning to work on more and actually implement, but never got round to.....

I think my own site's 404 is just some text saying sorry that page seems to have disapeared or something, with some links off to other things on the site.
Offline Go to the top of the page

Site Administrator

Group Icon
Group: Site Admin
Joined: 4-September 02
Posts: 6,887
From: Melbourne, Australia
post Nov 9 2004, 03:52 PM
Great topic php.

Custom 404 pages are vital to any website. It's amazing the number of people I've watched who've landed on a Page Not Found and thought they were the problem! A 404 is a simple way of telling your visitors that we've mucked up this page is no longe here but stick around anyway.

Although my website is outdated :oops: I do have one: http://www.nitrogen.net.au/xdcd

Here's another resource: 404 Resource Lab.
Offline Go to the top of the page

Lead Technical Administrator

Group Icon
Group: Admin - Top Level
Joined: 23-January 03
Posts: 1,995
From: Michigan USA
post Nov 9 2004, 05:02 PM
I don't quite have a phobia about broken links on my sites .. but it's close. smile.gif

One of my oldest sites has grown a lot in six years, resulting in three fairly extensive reorganizations of the hard disk. For the longest time, I would always leave the old pages right where they had been, changing only the navigation so it pointed to the new structure. This insured someone coming to the site would *always* find a page, but it also insured no one, including the search engines, was ever motivated to update their links. In short, it didn't work too well.

Back then, a 301 Redirect wasn't the cure-all Google has made it (actually, back then, Google wasn't even the major SE), and besides, some of my reorganizations would have confounded even mod_rewrite. So, after my last reorganization, I wrote what is essentially a database-driven custom 404 page. It know where things are, but remembers where things were, and tries to "guess" what the visitor really wanted. It also corrects some common typographical errors and, if the link is coming from a search engine, parses the query string and inserts their search phrases into my on-site search.

For the most part, it seems to have helped a lot. Here's a few examples:

Generic 404

Page has Moved

No folders or extensions

Coming from a search engine

Note: I wouldn't post these if I thought there was ANY chance they'd be indexed! It's been long enough since my last reorganization that I get relatively few 404's -- and I'd like to keep it that way. smile.gif
Online Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 9-January 04
Posts: 3,094
From: Canberra, Australia
post Nov 9 2004, 05:14 PM
Another 404 feature that can be helpful is automatically sending the details of the error to the webmaster. Don't worry about an e-mail link asking a user to do it - most won't bother - and they probably wouldn't even bother filling out a form either. smile.gif

The details you could send are the page that was requested, the referring page (if any), the time and date of the error, and the IP address of the user.

I've done that on my site, and I've found out that Google still indexes a page I used back in December last year, and people are finding it, and I've been notified of a few broken links on my site - since I knew where the user clicked, I was able to fix it.

My 404

After reading this topic, I'm going to be doing some work on my 404 page, including trying to work out how to submit the form through PHP without having to have a hidden form on the page that submits with JavaScript (the 404 page has to be a shtml one).
Thanks Michael!
Offline Go to the top of the page

Lead Technical Administrator

Group Icon
Group: Admin - Top Level
Joined: 23-January 03
Posts: 1,995
From: Michigan USA
post Nov 9 2004, 06:24 PM
QUOTE
The details you could send are the page that was requested, the referring page (if any), the time and date of the error, and the IP address of the user.

Those are all in your server logs, Tim.

What I'd really like to know, but have never implemented, is which link (if any) the user clicks on the 404 page.
Online Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 9-January 04
Posts: 3,094
From: Canberra, Australia
post Nov 9 2004, 06:33 PM
But rather than wading through the logs, this way I get a nice e-mail as soon as it happens. smile.gif

QUOTE
What I'd really like to know, but have never implemented, is which link (if any) the user clicks on the 404 page.

That's quite a good idea, and I think I'll take that when I redo my 404 page. smile.gif
Offline Go to the top of the page

Member

Group: Members
Joined: 10-June 04
Posts: 35
From: Los Angeles
post Nov 20 2004, 12:40 PM
Here's mine biggrin.gif

http://www.oldschooltoyz.com/clickedwrong.html

Jason
Offline Go to the top of the page

Untested

Group: Members
Joined: 13-July 04
Posts: 3
post Nov 28 2004, 11:32 PM
Hello all,

Just wondering, how do you "get a hold" of the page that was visited in error? For instance if I wanted my custom 404 page to really be a cgi script that not only returned an html page to the visitor, but also emailed me the url they thought they wanted to go to.

Is it something you put in your .htaccess file? Because, with a true 404 error, there will be no referrer.

Thanks in advance,
Jim R.
SponsorWorks.net
Offline Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 9-January 04
Posts: 3,094
From: Canberra, Australia
post Nov 28 2004, 11:39 PM
Hi m3p,

With my 404, it's a SHTML file, and I use the following variables:

<!--#echo var="HTTP_REFERER" -->
<!--#echo var="REMOTE_ADDR" -->
<!--#echo var="REQUEST_URI" -->
<!--#echo var="HTTP_HOST" -->
<!--#echo var="HTTP_USER_AGENT" -->
<!--#echo var="REDIRECT_STATUS" -->

All those get e-mailed to me when a 404 error is encountered. The Request_URI variable contains the page that was requested - i.e. the page that doesn't exist. And I usually find the referrer works fine.
Offline Go to the top of the page

Technical Administrator

Group Icon
Group: Technical Administrators
Joined: 3-February 03
Posts: 3,926
From: Sydney Australia
post Nov 28 2004, 11:40 PM
Hi m3p and welcome. That depends upon your server. On Apache (75% of most servers) it is really easy. http://httpd.apache.org/docs/custom-error.html has a pretty good explaination, and if you have CGI set up, you can run whatever you want at that point.

The email is a fantastic idea, although it may get very annoying if people link to dead stuff, or mispell something. IMHO, you would be better putting that stuff in a a DB and checking it, say weekly, or emailing a weekly report. I mean imagine, every misspelling, every bad link, all sending you an annoying email!!... it would drive you nuts!!!
Offline Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 14-November 02
Posts: 7,197
From: Los Angeles
post Nov 29 2004, 12:41 AM
That's true, Michael. I've noticed that certain Chinese and European search engines seem to drop directory names out of the URLs:

site.com/directoryA/page1.html
to
site.com/page1.html <= incorrect

This could result in an awful lot of emails.
Offline Go to the top of the page

Untested

Group: Members
Joined: 13-July 04
Posts: 3
post Nov 30 2004, 02:43 PM
First off, thanks for all the great replies.

Now, for the gory details.

When a "remote" url is used as the destination for a particular error, like the following:

ErrorDocument 404 http://www.domain.com/cgi-bin/script.pl?er...=%{REQUEST_URI}

the "%{REQUEST_URI}" doesn't get replaced with the real, bad, url.

In addition, none of the other environment variables that usually contain the bad url get sent either.

I'd like to use a remote url so that it can be pointed to by all of my sites, rather than have to incorporate the script into each site.

Any thoughts?

Thanks in advance.
Offline Go to the top of the page

Moderator

Group Icon
Group: Moderators
Joined: 15-January 04
Posts: 4,736
From: Rimouski, Canada
post Nov 30 2004, 03:37 PM
I use the emailed 404's on several sites since a long time and for me it works great. I often have a lot of things to jumble around and what is easier then to shove that missing whatever.gif to the bottom of the pile? Well, when you get reminded about it all the time the only way to stop it is to fix the error or disable the emails. I fix the errors much faster this way.

m3p, you can use a local 404 which catches the requested URL. Then automatically send the people through to the remote 404 with the requested URL attached as a query string.
Offline Go to the top of the page

Lead Technical Administrator

Group Icon
Group: Admin - Top Level
Joined: 23-January 03
Posts: 1,995
From: Michigan USA
post Nov 30 2004, 06:45 PM
QUOTE
Well, when you get reminded about it all the time the only way to stop it is to fix the error or disable the emails. I fix the errors much faster this way.

You're assuming the 404's are errors that can be fixed, Ruud. Most of mine (there have been 471 so far today) seem to be the result of "creative navigation." smile.gif

For example, a visitor clicks a link and finds themselves at /poems/love/ with a bunch of love poems. Then he clicks a link and finds himself at /poems/sad/ with a bunch of sad poems. It simply boggles my mind, sometimes, how often such a visitor then goes to the location bar and tries to go to /poems/sex/.

Not entirely sure how I can "fix" that one, ol' buddy. smile.gif
Online Go to the top of the page

Moderator Alumni

Group Icon
Group: Hall Of Fame
Joined: 9-January 04
Posts: 3,094
From: Canberra, Australia
post Nov 30 2004, 06:48 PM
You could create a "sex" directory, and just redirect it to your home page. No 404 errors then. smile.gif

I guess e-mailing depends on the site, eg. a small not well known site verses a large thousands of visits per day site. You wouldn't mind getting 3 404 errors in your inbox per day, but you would mind getting 3000 of them.
Offline Go to the top of the page
Reply to this topic Start new topic
2 Pages V  1 2 >
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Jump to Forum:
 
Lo-Fi Version Time is now: 9th February 2010 - 10:40 AM
Meet our Moderators: cre8pc : projectphp : sanity : Black Phoenix : bwelford : EGOL : Ruud : rustybrick : AbleReach : swainzy : joedolson: eKstreme: dazzlindonna : SEOigloo: iamlost : RisaBB
Cre8asite RSS Feed