Keeping users moving into and through your website without running into empty dead-ends keeps users happy and confident in your business. Unnecessary 404s put the brakes on browsing pretty quickly. Coping with unforeseen dead-ends and even planned site organization/navigation changes is paramount in preserving user confidence.
Consider all the links out there that point back to your site’s URLs… and how they’ll break if you’ve changed your site from straight HTML files to a JS or PHP-based file system. Or the special you ran during holiday season that went viral, and is still getting clicks, but is no longer in effect. And then guess how quickly an excited potential lead turns into a soured, disappointed bounce when they are greeted with a 404 error. However pretty your 404 page is, the answer is “light speed”.
Two primary tools available to the webmaster to combat these (and other) lead-loss guarantees are the 301 redirect and the 302 redirect. They both function the same way: pointing browsers looking for one URL to another URL.
- Browser: “I’m looking for the page about glass-faced cabinets.”
- Server: “We have that, but you’re in the wrong place. Go that way!”
- Browser: “Got it! I’ll go check over there!”
The difference between the two is in the indicated duration of the redirect. A 301 redirect indicates a permanent move from one URL to another. A 302 redirect indicates a temporary move from one URL to another, which will be reverted at some later date.
Implementing redirects is, thankfully, pretty painless. If your site is hosted on an Apache server (this is a good bet), some simple edits to your .htaccess file will do the trick. Google has some handy info at hand. If your website is built via WordPress, there are several simple 301 redirect plugins for quick and easy implementation. And as always, Moz has an excellent guide to redirection (and more!).
Whether you use a 301 or 302 doesn’t matter all that much to the user. They don’t see any of the HTTP response status codes, unless there’s an error (e.g., 404, 500). All they’ll see is the URL in their browser bar changing.
Search engines, on the other hand, do care. When a crawler indexes sites, it needs to know whether to purge the old URL completely, or to check it at a later date. It does so by taking stock of 301 vs. 302 redirects.
- If you intend to revert the redirect at some later date, it should be a 302 redirect.
- If you intend to never revert the redirect, it should be a 301 redirect.
Like any tool, there are intended beneficial uses, and unintended malignant uses for redirects. Keeping users on-site, moving to content they’re interested in, in an unobtrusive way, is the intended best use. If you’re not careful, though, you may redirect users several times in a row (URL A redirects to URL B, which was previously set to redirect to URL C, and so on), which can disrupt their browsing experience. It’s even possible to create a loop of redirects, which would trap users until they kill their browser process completely… fortunately modern browsers can detect them and kill the redirection before things go awry.
Downright malignant tactics are available via redirect abuse. But you’re not interested in those, so I won’t go into them!
Redirects are a simple, powerful tool for preserving your website integrity and protecting your user’s experience. Careful use can yield fantastic results; but sloppy use can bring your users to a halt!