How to Build 301 Redirect Lists

When you are redesigning a website, its quite common to need to change page file names. That presents a potential (but easily avoided) problem from the search engines perspective.

Not providing a site-wide 301 Redirect pathway from all old page names to all new page names means your entire old site will be de-indexed. That’s usually pretty catastrophic on website traffic for at least a few weeks, possibly months!

  • This terminates all rankings for affected pages
  • 404 Page Not Found error rates increase dramatically
  • Search engines are forced to begin indexing and evaluating new pages from zero…
  • All your client’s bookmarks to your site’s internal pages are rendered useless

The tragedy here is that all of this is completely avoidable! Here is a solid methodology to eliminate the FUD factors (fear, uncertainty and doubt) from the redirect process. If your website is on an *Apache web server, the procedure is relatively straightforward;

  • list the old pages
  • match them to new pages
  • convert the list to 301 Redirect format
  • copy and paste the list into the .htaccess file in the root directory

NB: any syntax error, white space or hidden characters in the .htaccess file will “break” your site, so its a good idea to be emotionally prepared for hiccups.  Make a backup copy of the .htaccess file before you start!

*If your site is on an IIS server, the process is not at all straightforward, and requires that you have administrator access to the server, unlikely in most hosting accounts…

Step 1: List Your Old Website’s Pages

Before you start rebuilding, make sure you’ve got a full list of every page on your original website. The most efficient way is to build a URL LIST using one of the online sitemap generators. The one I use is; http://www.xml-sitemaps.com

This site offers you the opportunity to download XML, HTML and TXT files. Download the urllist.txt file.

  • Open Microsoft Excel
  • Import the urllist.txt file
  • Save this as an Excel workbook

In the a spreadsheet, use “Search and replace” to remove the http://www.my-domain.com section so that you are left with a column of page file names preceded by a forward slash – e.g.;

http://www.my-domain.com/page-number-one.htm becomes /page-number-one.htm

http://www.my-domain.com/directory/page-number-one.htm becomes /directory/page-number-one.htm

Step 2: Add the New Page Names

Leave 2 empty columns after the old page name columns. One will be used for a special character, the other as a spacer. Then, enter the new page URL in full beside the relevant old page…

Once you’ve completed the process of building side-by-side listing of old and new pages, we need to prepare them into the correct  format for the .HTACCESS file. Using Columns A through to F, the layout is like this;

A=REDIRECT                                  B=OLD NAME               C=$ D=0  F=NEW FULL URL

RedirectMatch permanent ^/directory/page-number-one.htm$ http://www.my-domain.com/directory/page-number-one.php

This is where Excel comes into its own…

  • In a column to the left of the list of old page names, copy in “RedirectMatch permanent ^” for each item in the list.
  • In the first column to the right of the list of old page names , copy in the $ character.

Step 3: Combining Fields in Excel

Excel has a command that allows us to concatenate the contents of 3 cells into a new cell;

Concatenate 301 Redirects + Old Pages

Excel has another command that allow us to;

  • take the contents of D
  • add the space via the double quotation marks
  • take the new file name URL in column E
  • and insert the new string into column F

=D3&” “&E3  could output the following example;

RedirectMatch permanent^/about.html$ http://www.my-domain.com/about-our-comapany.php

Select the contents of Column F  and paste them into Notepad – the formulas are converted into values via the copy/paste process.

  • save the file as 301-redirects.txt somewhere that you won’t lose it…

Applying the 301 Redirects

Copy from 301-redirects.txt to the .htaccess file in the root directory of your live site.

Test it is working correctly by copying an OLD page URL into your browser, and watching to see that it redirects to the specified new page.