Redirects

A redirect is used to indicate when content has moved from one location to another. For example, you may have some content at http://www.yourdomain.com/old.html and decide to restructure your site. As a result of this move, your content may move to http://www.yourdomain.com/critical-keyword.html.

Once a redirect is implemented users who go to the old versions of your pages (perhaps via a bookmark they kept for the page) will be sent to the new versions of those pages. Without the redirect, the user would get a Page Not Found (404) error. With the redirect, the web server tells the incoming user agent (whether a browser or a spider) to instead fetch the requested content from the new URL.

Why and When to Redirect

Redirects are also important for letting search engines know when you have moved content. After doing so, the search engines will continue to have the old URL in their index and return it in their search results. The solution to this is to implement a redirect. Here are some scenarios in which you may end up needing to implement redirects:

  • You have old content that expires, so you remove it.

  • You find that you have broken URLs that have links and traffic.

  • You change your hosting company.

  • You change your CMS.

  • You want to implement a canonical redirect (redirect all pages on http://yourdomain.com to http://www.yourdomain.com).

  • You change the URLs where your existing content can be found for any reason.

Not all of these scenarios require a redirect. For example, you can change ...

Get The Art of SEO now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.