Redirects

A redirect is used to indicate when content has moved from one location to another. For example, suppose you have some content at http://www.yourdomain.com/old.html, and you decide to restructure your site. As a result of this restructuring, 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 bookmarks they have kept for the pages) 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 important not only for users, but also for letting search engines know when you have moved content. After you move a page, the search engines will still have the old URL in their indexes and will continue to return it in their search results until they discover the page is no longer there and discover the new page. You can help speed up this process by implementing 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 ...

Get The Art of SEO, 2nd Edition 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.