Google Webmaster Central Blog - Official news on crawling and indexing sites for the Google index

Make your 404 pages more useful

Tuesday, August 19, 2008 at 10:13 AM

Your visitors may stumble into a 404 "Not found" page on your website for a variety of reasons:
  • A mistyped URL, or a copy-and-paste mistake
  • Broken or truncated links on web pages or in an email message
  • Moved or deleted content
Confronted by a 404 page, they may then attempt to manually correct the URL, click the back button, or even navigate away from your site. As hinted in an earlier post for "404 week at Webmaster Central", there are various ways to help your visitors get out of the dead-end situation. In our quest to make 404 pages more useful, we've just added a section in Webmaster Tools called "Enhance 404 pages". If you've created a custom 404 page this allows you to embed a widget in your 404 page that helps your visitors find what they're looking for by providing suggestions based on the incorrect URL.


Example: Jamie receives the link www.example.com/activities/adventurecruise.html in an email message. Because of formatting due to a bad email client, the URL is truncated to www.example.com/activities/adventur. As a result it returns a 404 page. With the 404 widget added, however, she could instead see the following:



In addition to attempting to correct the URL, the 404 widget also suggests the following, if available:
  • a link to the parent subdirectory
  • a sitemap webpage
  • site search query suggestions and search box

How do you add the widget? Visit the "Enhance 404 pages" section in Webmaster Tools, which allows you to generate a JavaScript snippet. You can then copy and paste this into your custom 404 page's code. As always, don't forget to return a proper 404 code.

Can you change the way it looks? Sure. We leave the HTML unstyled initially, but you can edit the CSS block that we've included. For more information, check out our guide on how to customize the look of your 404 widget.

This feature is currently experimental -- we might not provide corrections and suggestions for your site but we'll be working to improve the coverage. In the meantime, let us know what you think in the comments below or in our group discussion. Thanks for helping us make the Internet a more friendly place!


The comments you read here belong only to the person who posted them. We do, however, reserve the right to remove off-topic comments.

53 comments:

developdaly said...

Anyone have an example up yet?

dLux said...
This comment has been removed by the author.
dLux said...

Yes, I installed it for testing: http://dlux.hu/blog_archive.html

Keith said...
This comment has been removed by the author.
Keith said...

Ditto on BusSongs.com. Example at: http://bussongs.com/halloween_song.php

sam said...
This comment has been removed by the author.
sam said...

http://www.cddimensions.com/404.asp
The Site Map below is not part of the widget

ShoreTel said...

The code appears to use document.write() and is otherwise NOT XHTML compliant.

Any chance Google will change the code to use the DOM compiant document.createElement() instead? If you need help, talk to the Google Analytics team, they seemed to have figured out how to do it.

der5er said...

Grr...looks like the server where the js file is hosted (http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js) is blocked by WebSense SurfControl as "Freeware and Software Download"

So, if you put this code in your page, anyone hitting a 404 on company time will get javascript errors (assuming the company uses WebSense).

Yeats rag said...
This comment has been removed by the author.
Yeats rag said...

It works a treat. Looks like a real lifesaver when fidgetting around with URL rewrites.

http://www.gezinsspaarkaart.be/actiez

webado said...
This comment has been removed by the author.
webado said...

Ok, try again.

Ok, it doesn't work for me.
I can't have moofed it, can I?

It's not giving me any alternatives. It only suggests to search for a better word.

When clicking the search button it in fact loads the same page with a query string for the search term. But since my page is an error page which preserves the url of what was being accessed, with a 404 response, not a search script by itself.


Aaaarrrgghhh LOL

See it here: www.melinas-music.com/discography.html .

The closest match should be discography.php and in fact a couple more similar ones.

I'm going to have to try to understand the js script itself ... uhh ... js is not my thang LOL

Brian Kreck said...

Make sure your custom page properly returns the 404 Not Found error in the page headers. It's not uncommon to see people create 404 pages that return a 200 Successful response.

Frank Eybsen said...

Hack for the Google 404 page here (could be useful to keep visitors on your site): http://www.seomfg.com/google-tips-and-tricks/customizing-googles-404-error-page-enhancement-with-a-css-modification/

Alden Bates said...

Neat! I was trying to do something similar in perl, but this will work a lot better than my attempt.

WWW said...

Hello,

It seems that the link to the parent subdirectory and the sitemap doesn't work for me...

Example

Any idea?
Thanks

hogyob said...

Hi - Very Helpful.
Could you clarify - what are the potential implications of not having appropriate 404s in place on site subfolders. I've been advised that this is a complete no-no - but when implemented I have seen no change in Googles indexing of site pages or positions in the search results.

anon said...

Too bad its not been employed on the Official Google Webmaster Central Blog (www.blogger.com) yet.

http://googlewebmastercentral.blogspot.com/2008/08/make-your-404-pages-more-

trungson said...

Very neat idea, but the time it takes to implement the widget is about the same time I can write my own custom 404 page with the same functionality.

Storm Website Design said...

Thanks for this, we have added it to our custom 404 page, every little helps.

George Wilson said...

Can you integrate a Custom Search into this 404 script?

Ashish said...

Right! Having the custom search option would allow us to control it more. $$$

:)

NEROPOWER said...

Thanks

fun and more useful 404

http://www.rioserver.com

passionforpuzzles said...
This comment has been removed by the author.
redtape said...

Hi, I'm having a problem with the sitemap url. I was told to use rss feeds/atom feeds but nothing is working. I keep getting a 404 error message. Someone please help. Before this I had no idea what a sitemap even was.

My blog is internet-hype.blogspot.com

magnus.obel said...

The widget dosent work for me in IE. I get javascript error (unkown error..). If i put it in the header it works fine.

In firefox it works fine.

Arunachali said...

I am not seeing the snippets as shown in google webmaster tools - maybe because all of my pages aren't indexed yet.

this is a great widget for all kind of users, humans and bots. Hope this helps me get my pages index faster. Google hasn't updated my site for a month now.

view my tweaked implementation
http://arunachal.ne8.in/news/discuss.php?pid=199999

James said...

Just added this to my blog a few days ago - always like ideas that make the experience better for the user.

http://gorley.com/ - texas best steaks, camping, country music and more.

Try this to see it in action:

http://gorley.com/404

koko said...

Very neat idea, but the time it takes to implement the widget is about the same time I can write my own custom 404 page with the same functionality.
I have implemented this in my site
http://www.instantdownloads4u.com

pabitra said...

Why google doesn't remove the 404 errors even I have already solved them or I have removed all the related files and related links to it. Give me some idea....

A. Michael Bussek said...

A) Is there a solution for blogspot.coms yet?
B) Why not?

http://preeedict.blogspot.com/2008/08/nostradamus-obama-mccain-and-mabus.html

wa7eed said...

Hi
can I put My search form
from google adsense ?

ayhan said...

thk you
http://www.sevsen.net

ayhan said...

thk you
http://www.sevsen.net

Kayden Kelly said...

Hi Maile,

I ran into you at the SES conference where we chatted about the custom 404 widget. As I mentioned, we did add the ability for users to easily enable/disable this functionality on the custom 404 pages they can create using our ecommerce/cms web site marketing platform called Motivity. Here is a link to our blog post about it: http://www.blastam.com/broadcast/2008/09/google-custom-404-widget-helps-provide.html

Please let me know what you think if you can. Thanks!

elightbo said...

What an excellent article: Works beautifully on our site:
http://www.uwgb.edu/webmail

robert said...

Hey, thanks for the article.
I did that to my Europe website
www.EuropeWord.com

kshu said...

Hi. Like wa7eed pointed out above, it would be great if the “Enhance 404 pages” feature from Webmaster Tools could use the search from AdSense (or Google Coop monetized), instead of a regular search from Google with only the site parameter set, like it does now.

TimOOn said...

The widget idea is really a good sign from GG webmaster tools to become transparent,... but still the process is risky because of loosing a part of audience by using AdSense or external choices.

The widget should be more customizable, a really open API would be nice ;-)

Jon said...
This comment has been removed by the author.
karthik said...

Hey any one plz help me... i moved my domain to blogspot... How can i include a custom 404 error page for my blogspot domain ???

Thierry said...

Hello everybody, I would like to know if it's possible to have it in white font. My background is dark and the black font is barely visible. Check here: http://www.wesdotphotography.com/404.html

After I will have to solve the problem of showing this page with my web hosting company instead of there own 404 page.
Thanks again
Thierry

Linkgraph said...

Linkgraph is another 404 widget, only the Linkgraph widget gets the correct URL using historical page movement & name change information from the database. The information in the databae is collected by an indexing application on the web server.

You can see a demo at demo.linkgraph.net

Preservation Nation said...

Anyone try using this as an embedded component? We use a CMS here and I can't get the actual code into a page, have to embed it. This works fine and dandy, but rather than searching for terms in the bad url, it looks for terms in the 404's url--every time a user lands on the custom 404 page, the suggested page is the 404 page itself. Capice?

Atta said...

http://www.dubaivisacentreonline.com/visaforms.php

Here is nice example to show it using existing style sheets. You can further add main contents (Navigational Links) of your sites to this page.

In Apache: These pages can be found inside folder, error_docs.

However I just wonder that why Google is not providing closet Match right now for above URL.

Pat said...

I've added this to my CRM & Web Issue Tracking website today. With some effort, I was able to integrate it with my CMS and make it look like it was a functional part of my site.

This widget along with the data from analytics (how they got here) will help me clean up navigation/404 issues.

Thanks again for a great widget.

Evgeny said...

hello to all. my site works in windows-1251. after installing vidget 404, messages of him in utf-8, IE can not show it correct. How can i solve this problem??

Sarfaraz said...

yea i tried it

http://www.storage-clothing.co.uk/404.php

Kevan said...

Hello All,

I've installed the script in the 404 page of a Magento store and it seems to work fine. However, the script's suggested search terms always start with the word mugen which isn't on any page in the store.

In other words, for the url www.domain/st-louis-style-ribs , the suggested search terms in the form are:

mugen st louis style ribs

Any clues?

Thanks for any help!

urbiegee said...

Does anyone know how to remove this widget?

tung148 said...

Thanks. very useful

Maile Ohye said...

Hi everyone,

Since some time has passed since we published this post, we're closing the comments to help us focus on the work ahead. If you still have a question or comment you'd like to discuss, free to visit and/or post your topic in our Webmaster Help Forum.

Thanks and take care,
The Webmaster Central Team