404s & Heartbreak: Prevent Dead-ends with URL Redirection

We’ve all experienced visiting a URL and then ending up on a 404 Not Found page. Why did that happen? And what the heck is the “404”? This post will look at what a 404 error is, and ways we can cut down on users ending up at dead-ends on our site.

The Notorious 404

The reason we end up on a 404 page is that the web page or resource we are trying to access is no longer available. We request something, the server looks for it, and since it doesn’t find what we asked for, it let us know with the status code 404. Web servers have a code for every response (200 is the one it normally sends when everything is okay), and 404 happens to be the code sent back when the requested web page could not be found.

This is known as a broken link. If the information users are looking for was moved to another part of the site, we want to make sure that users can get there without any effort. Fortunately, we can use URL redirection to make that happen!

What is URL Redirection?

URL redirection, or URL forwarding, is the technique of giving a web page multiple URLs from which a user can access it. This is especially useful when a web page’s URL has changed, either from a site migration or an update to a site’s URL structure.

Think about it like mail forwarding for physical addresses: When we move from one address to another, people may still send us mail to our old house, so we let the post office know our new address and our mail is properly forwarded to us. This is similar to the web: When someone tries to access a web page at an old URL, we tell the server that whenever someone tries to access this URL, send them along to a new URL where the web page lives now. Like mail forwarding, this rule needs to be set up beforehand, otherwise the user will end up at the old URL and get the 404 Not Found page.

Setting up redirection is also good for Search Engine Optimization (SEO). Search engines, like Google, crawl our site in order to index pages for its search results, and if it finds a bunch of URLs that result in 404s, it will interpret that as a lower-quality site that is not being maintained and therefore rank it lower.

When to Use Redirection

It’s important to redirect URLs when content has moved on our site. This makes sure our users are finding the information they expect while also cutting down on unnecessary 404s. Some common reasons for using URL redirection are:

  • Site Reorganization: Setting up URL redirection is especially important when a website is re-architected and redesigned. Pages or posts could move, URL structures could change, or pages could be removed altogether. Here at Visceral, we use software to create a list of a site’s URLs and then map them to the URLs on the new site using the popular WordPress Redirection plugin. Even updating a URL of a page that is already published could break a link, so make sure to add a redirection in that case too.
  • Vanity URL: Redirection can also be used for vanity URLs, which are shortened URLs meant to be memorable and/or short for marketing purposes. Instead of the URL https://example.org/what-we-do/our-priorities/educational-programs/stand-up-for-youth/ we could create a shortened URL https://example.org/youth. This is a lot easier for a human to read and fits nicely in a Facebook or Twitter post.

What to do with Expired Content?

Sometimes pages need to be removed because they are no longer relevant. Since this content is being deleted instead of moved, how should we handle redirection? There are a couple of different options for this:

  • Redirect to the old URL’s parent page: This can often be thought of as redirecting to the most similar or relevant content which will keep the user engaged.
  • Redirect to the homepage: This is a catch-all redirection that sends a user to the base page of the site.
  • Don’t redirect and let the user get to the 404 page: Sometimes it’s okay for a user to get to the 404 page. After all, the page no longer exists and the 404 page is doing its job!

Make the 404 Page Useful

While we generally want to avoid the 404 page, it can provide a valuable purpose when users end up following a broken link or mistyping a URL. At the bare minimum, we should have a page that matches the rest of our site design and tells the user something went wrong. Other ideas to make it more functional include:

  • Tell them why or how they got there. Explain that the site organization has changed which might be why they can’t find what they’re looking for.
  • Add links to go to prominent parts of the site – little nudge will keep our users from leaving.
  • Add a search form to give the user an easy opportunity to search the site to see if what they are looking for is somewhere else.
  • Get creative and showcase your brand. Users will already be slightly disappointed that they didn’t get what they were looking for, so delightfully surprise them something fun and creative!

Wrapping Up

404 pages are an important and necessary part of the internet. Web content is always being added, updated, and removed and users will inevitably try to access a URL that no longer exists. But, with the some forethought and planning, we can help our users get to where they need to go by using URL redirection and having a useful 404 page.

Travis Johnson

Technical Director

As the Technical Director at Visceral, my job is to make sure our development team creates awesome work for our clients!

More about Travis