Back

How to Complete a Mass 301 URL Redirect in Magento

Whether moving from a different platform or upgrading to a newer version of Magento, a key consideration when building a new Magento website is your SEO migration strategy. The essential component in this strategy is the way how you approach every single Magento redirect – the part where you move URLs.

This is a sensitive part as, if not done carefully, it can result in unexisting pages (404), broken internal and external links and bottom line – lost rankings. The worst part of it is that that part can’t be repaired easily afterwards.

Mass Magento redirect – How to prepare?

Once you have uploaded your products to Magento, you will potentially have a list of new URLs for them.

If that is the case, it is necessary to redirect your old URLs to the same page on the new site. This is where we use the “301 redirect” extension for your URLs, which essentially tells the crawlers of a search engine to remove the old URL and replace it with the new one. In addition, it will also automatically redirect anyone who visits the old URLs to the new one.

If you have a small amount of products, you can easily get by using the URL rewrite management feature of Magento. However, it is probably not a good solution for redirecting thousands of URLs considering the time required to get the job done.

Managing mass configuration in Magento, including 301 redirect is a skill on its own, independent of your general data entry or programming skills. In particular, knowledge of Excel or OpenOffice Calc coupled with the understanding of the Magento basic product structure of the new Magento site will ease the .csv file creation process required for the mass configuration in Magento.

Steps for a mass 301 Magento redirect

1. Preparing a list with URLs

Prepare a spreadsheet with the list of old URLs and new URLs. If you are an agency, you can ask
your client to provide you with this spreadsheet. The file will have two columns, a column for the old URLs and another column for the new target URLs.

2. New spreadsheet with adjustments

The spreadsheet in step 1 will be used as the basis for the URLs import. You need to prepare a new spreadsheet file with additional fields and adjustment.

  • Copy the list from your first spreadsheet to the new one.
  • Ensure the column containing the list of old URLs is named “request_path” and the column containing the list of new URLs is named “target_path”.
  • Add a new column called “store_id”. To fill in this column, you will need to open the backend ofMagento, open the store_view from System > Manage Shops.
  • In the example (see figure 1 and 2), the store ID is 1, so you can populate the cells in “store_id” column with this value.
301_upload_1
  • Figure 1. Open default store view from System > Manage Shops
301_upload_2
  • Figure 2. Find the store ID from the URL path.
  • Add a new column called “id_path”. This is a unique id for a particular URL rewrite. You need to use the format “custom/XXX” where you can replace “XXX” with unique number for each line.
  • Add another column called “options”. Fill in every cells with “RP”
  • Rearrange the columns as follows: store_id, id_path, request_path, target_path, options
  • Save the spreadsheet as .CSV with (,) as field delimiter and (“) as text delimiter.
301_upload_3
  • Figure 3. Example csv. file for the import.
  • Go to the database of your shop through PHPmyAdmin and open table “core_url_rewrite” and go to the “import” tab. Find the saved spreadsheet and make sure you choose partial import and skip the first row (start the import from row 1 instead of 0).
  • Type in store_id, id_path, request_path, target_path, options.
  • Click Go and you are done. Double check for any broken links.

There are other ways to do mass importing using additional third-party modules or .htaccess. Using .htaccess file is a less desirable alternative because it is parsed for every request and can slow down your website which is bad for SEO.

Preparing the redirects is not a complicated task, but it requires a lot of attention to detail. Take your time to do it right! Or contact us, an experienced Magento SEO agency.

Share It! Tweet it! Publish It!