So you've got a website redesign going on. Exciting! But the one thing that most folks find less exciting than the reveal of the bright and shiny new website is the behind-the-scenes efforts to retain organic search rankings. 301 redirects, while necessary, are rarely a fun endeavor, and the formatting can take forever. Here's an easy way to quickly format your 301 redirect mapping for non-dynamic pages to match .htaccess formatting.
Step One: Map the Old Web Pages to the New in Excel
The mapping step takes time, but is relatively straightforward. Create a Microsoft Excel spreadsheet with two columns -one for the existing URL and one for the new URL to redirect to on the new website. For each old URL that is changing, enter a new URL in the appropriate column. Use the full website URL. For instance, we just relaunched our Search Mojo site and had some old pages that needed to be redirected to new versions.
Step Two: Format the Excel Document to Match .htaccess Formatting
After the mapping is complete, follow these steps to format the data in Excel to match the 301 redirect formatting required for .htaccess:
1. Select the old URL column and remove the main domain. For instance, if the old web page is "http://www.search-mojo.com/about-us.php," the replaced domain URL would be "about-us.php." You can easily do this for all of the URLs by hitting CTRL-H to do a find/replace, then replacing the domain (with trailing slash) with "redirect 301."
2. Select all of the cells in the old site column and the new site column, then copy and paste into a word document.
Step Three: Edit the Data in Word
Pasting the data from Excel into Word will paste the data as a table.
You'll then want to change the table to text. Select the table, then under the Table/Format menu, select "Convert Table to Text" and select "Other" for the separator option. For other, use a single space.
Step Four: Adding to Your .htaccess File
Finally, you'll want to add the reformatted redirects into your .htaccess file. Download the .htaccess file from your server. Open it in an HTML editing program (or even notepad or the like), then copy and paste your redirects from Word into the .htaccess file. Save the file, upload to your server, and you're done!