These are all valid scenarios and it is recommended to think about those urls especially when migrating and the option is on the table. Just don't forget, you want to preserve those old dead links and provide a redirect to get all those back links to the right place. One approach could be to generate a ton of mod-rewrite lines and handle it at that level, that could be one option. You are already writing a process to migrate those articles, and hopefully you are using the Migrate Module? If not, seriously consider it.
Now that you've built your article migration out, you are so very close to making all of those backlinks redirect. First, go out and get the Redirect module, which works with the Global Redirect module, which you should already have if you are concerned with SEO.
Next, provide the existing alias for the content as a field (I'll call it ContentURLAlias) in your migration, but there is no need to map it.
The next step is to expand on the content migration and override the complete function. When we do this, we will call the redirect methods to take the new path of the entity that has just been saved back to the database, and the alias passed in and create our redirect like so:
public function complete($entity, stdClass $row) { $redirect = new stdClass(); redirect_object_prepare($redirect, array( 'source' => $row->ConentURLAlias, 'source_options' => array(), 'redirect' => $entity->uri['path'], 'redirect_options' => array(), 'language' => LANGUAGE_NONE, )); redirect_save($redirect); }
And that is it! Along with the redirect module you'll get tracking statistics on these old backlinks so you can recall when they get stale and decide when the safest point would be to clean them up or retain them permanently.
I hope this was helpful!
No comments:
Post a Comment