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
- Download the Not Found errors by clicking Download this table in Webmaster Tools
- 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.
- 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.
- The 301 redirect syntax will populate column C in the same row. You can paste that into your .htaccess file.
- 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.
Thanks for this post and the excel spreadsheet. I have a client who is having me redo a website and the current website has over 400 pages. Most of which are garbage. What I consider unethical and even useless SEO. I condensed the site and did it the right way seo-wise, but need to redirect all the pages to the new ones in case someone follows the link. You saved me a lot of time wit this!
Glad I could help!!
Very useful Geoff. On a related topic, here’s an Excel tool to check a long list of URLs and return the results (redirects etc)
http://www.tips-for-excel.com/tools/url-checking-tool/
Hope this is of use!
This is a solid template for 301 problems, the format is suitable for wide variety of 301 issues, a perfect partner for any SEO. The WP Plugin was also helpful. Thank you for the file.
This is a very nice article on htaccess redirect i like your article.
Nice – was just what I was looking for to save me some time. Cheers
Excellent!! Very useful. You saved my time.