Redirect your old files with a 301

January 20th, 2009

Problem

Assuming there is a change in structure/page names etc, an often overlooked aspect of re-developing an existing website is to add proper redirects to let users and search engines know where to find the new versions of already bookmarked/indexed pages. The chances are that when the old site has been upgraded, the content on those pages becomes out of date and incorrect fairly quickly, the old pages may also have been completely deleted or in the case of switching to a new hosting setup, have never existed. This means that the next time your users click on that bookmarked link, or when the search engines return to crawl your site again, the pages either return out of date information or even worse, inform both your users and the search engines that they don’t exist. Needless to say, this is not the result you are looking for from your new and lovingly crafted website.

Solution

Making sure your users and the search engines remain happy when they request one of your pages is actually very simple, all you need is a list of your old pages, a list of your new locations, a text editor and FTP access to your hosting. The solution is to use a “301 redirect”, this is an Apache specific method and wont work under IIS. (If you are running an IIS server, see the link at the bottom of this post for further details)

Examples

Here are the steps to take at the most basic level:

Create a new text (.txt) document and save it as .htaccess

To redirect a single file (or list of single files):

Redirect 301 /old-file.html http://www.shiny-new-website.com/new-file.html

To redirect all of the old pages to your new website:

RedirectMatch 301 (.*) http://www.shiny-new-website.com/

Upload the .htaccess to your website’s root folder (where you’re index page is) and check that when requesting the old URL’s, you are redirected to the new URL’s

Links

Apache  - Apache mod_alias documentation

Using IIS? - IIS 6.0 Server Administration Guide

Entry Filed under: server, web talk

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

Calendar

December 2017
M T W T F S S
« Feb    
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

Most Recent Posts

Feeds