Tag Archives: htaccess

Generate 301 Redirects in Excel

If you are not using Google Webmaster Tools then stop reading now, sign up and come back, we’ll wait. OK now, say we are analyzing the Diagnostics > Web Crawl section in Google Webmaster Tools and notice that there are some Not Found errors. One way to fix these errors is to redirect them in .htaccess using a 301 Redirect.

Here is a handy spreadsheet (301-generator.xls) that I use to create my redirects using the data I download from Webmaster Tools. If you don’t like opening spreadsheets from an unknown blogger, then scroll down to the bottom of this post for the formula! 

How to use it

  1. Download the Not Found errors by clicking Download this table in Webmaster Tools
  2. Copy the non-domain part of the bad URL in first column (URL) of the spreadsheet downloaded from Google Webmaster Tools. Paste it into the next open field in column A on the 301-Generator spreadsheet. The non-domain part is everything after the http://www.yourdomain.com part of the URL field.
  3. Paste or Type in the new destination (in FQDN or Fully Qualified Domain Name format) into column B on the same row as the bad URL in step 2 above.
  4. The 301 redirect syntax will populate column C in the same row. You can paste that into your .htaccess file.
  5. All requests for the bad URL will now be redirected to the new destination.

Important

  • Always make a backup of your .htaccess file before making modifications. 
  • Always test the results of your changes, you may inadvertently redirect traffic from your homepage or otherwise make your site inaccessible.
  • If you are using WordPress you should use the Redirection plugin instead of .htaccess 

Excel Formula

If you just want the formula, and not the spreadsheet, read on:

  • In column A1 type Bad URL
  • In column B1 type NEW URL
  • In column C1 type 301 Syntax for htaccess
  • In column C2 enter the formula
    • =”redirect 301 ” & A2 & ” ” & B2
  • Copy that formula to all cells in column C as needed.