Best Practices for Error Pages

Today we're talking about the best practices for handling errors and error pages on websites. When people come to your website, they get a nice status code 200. This means everything's okay and the page’s content is there. Sometimes errors can pop up and they're not always a bad thing. Sometimes you intend for them to happen.

404s

So, for example, when someone requests yoursite.com/gobbledygook URL that doesn't actually exist here, you actually want to be returning a 404. If the page is a valid URL, it should register. But if it's an invalid URL, you don't want to be throwing a 200 page that just says, "Hey, you probably lost what you're looking for." That can create a lot of duplicate content in the search engines. Google will be crawling all over like, "Man, every single URL that we can possibly imagine on this website is a 200 page." So you can use a 404 for that.

410s

410 is a status code that you can return to search engines and browsers. This status code can be returned when a page is in the search engines and you need it permanently removed. So for your average browser, they'll come and they'll get something just like a 404 page. You can have a custom 404 page that does fun stuff. One of my favorites is on Distilled.net. You can check out their 404 page.

But a 410 tells search engines, to get a page out of their index. This is not an accidental error. We intend for this page to be gone from our web server. We don't want you or anyone else visiting ever again. 410 is a way to kick a page out of search engines indices. With a 404, sometimes they'll see a 404 and think the page is just down. Maybe it's just broken. Let's kind of leave them in there till we're sure. 410 means it’s permanently removed.

301s

A 301 is what you'd use when you have an error page, but maybe many people are hitting it, or you would actually like for that URL to go somewhere if people type it in. So you can use the 301 redirect to say, "Hey, this content that you're looking for is permanently now over here, or is permanently over. It was never over here. This was an error page, but I'm going to 301 you over there."

Site Errors

First off, if a site links to you incorrectly and for some reason they're sending a lot traffic you should use a 301 redirect to push the wrong URL traffic to the correct page. "Hey, all these people are pointing to this bad page here, this 404 page. We're giving users a bad experience. We're giving search engines a bad experience. Let's 301 it over to a place where we can serve that intent and what those users and websites were looking for when they linked to us."

Monitoring

I do recommend regularly monitoring. Go and look through your crawl logs. Go and look through your request logs and find out if you have a lot of pages that are 404-ing.

You can also do something similar to this. This won't look at requests, but this will look at links. You can go to your report in Link Explorer, into your Top Pages or in Moz Analytics, your Top Pages in the Link section, and you can see pages that might be 404-ing that have lots of links pointing to them or have lots of requests to them if you look at your log files.

This way you can actually redirect or get those fixed. It could be that they were broken accidentally. This happens quite a bit on the web.

Site Outages & Maintenance

If your site or server or page is temporarily down or you're doing some maintenance work make sure to use a 503 status code. A 503 tells search engines and browsers this page is temporarily down for maintenance of some kind and to come back later. It will be available here soon.

Don't want to put up a page for maintenance that is about that's actually a 200. This happened to the Walt Disney Company and Disney.com many years ago. They had this error over the course of three or four days. They were doing some site maintenance and it happened to take a long time. Google had indexed all of those pages as saying, "The site is temporarily down." Until they revisited those URLSs, for a week, a ton of the pages on Disney's website was showing a snippet that said, "Our website is temporarily done. Please return later, " which destroyed their click-through rate, killed their search engine traffic, just sucked. Don't use a 200 when you're temporarily down. Use a 503.

Thanks for learning!

Put your skills to work

Download MozBar

The MozBar SEO toolbar shows you relevant metrics right in your browser, as you surf the web.