Bulk Redirect Magento Urls

A client needed to enter a bunch of urls to redirect today on a site. This can be easily done one at a time through the Magento admin at Admin > Catalog > Url Rewrites. That's a bit of a slow process. So to that end, we've got a DB direct method using load local csv to compliment: To start, you'll need a spreadsheet with the following contents:

Database Column Definitions (and what you need to give them)

url_rewrite_id

This is an auto generated id. You should not supply anything to this column.

store_id - Column 1

Your store id to redirect inside. For most single store sites, this will 1. You can get a list of store id's from data in table core_store or through the admin at Admin > System > Manage Stores and viewing the store_id/# parameter that comes in the resulting urls.

id_path - Column 2

This just a unique id for the redirect. It's a psuedo human friendly value. The actual value doesn't matter, as long as it is unique. The internal system uses category/, product/ #####_##### paths. I would suggest you add your own using custom/## for those created through the admin, and bulk/### when doing bulk redirecting so you can get the new starting number each time you do this.

Example: bulk/1, bulk/2

request_path - Column 3

This is the from address. Where people are currently going that you want them away from. You must format this without a preceeding slash or request host url. 

Example: coffee/special-blends/best-coffee-ever

target_path - Column 4

This is the to address. Where you want people to end up. You must format You must format this without a preceeding slash or request host url. 

Example: coffee/special-blends/best-coffee-ever-was-a-lie

is_system - Column 5

This one's fairly obvious. It's a bit indicating if the system created this rewrite or not. System created rewrites can be deleted and regenerated easily. Make sure you mark your custom redirects as zero 0, as you are not system.

options

This requires a bit of just go with it. The value here to redirect using 301 is RP.

Once you have your sheet all filled out, use csv's load local into the number columns above and it should work. Always back up your database table prior to imports.

Tags: