3

I am migrating a site from wordpress and need to preserve my url structure whilst supporting native pathauto urls in the future (for new content)

Overall Drupal's clean url process is almost identical to wordpress but I am finding some small discrepancies and with around 2k posts to migrate over I need a programmatic way to do this that won't feel like I'm trying to roll a keg up hill.

I was thinking of inserting in the old wordpress url as field_legacy_slug and then I could create paths based on that, but... as far as I know pathauto doesn't have any conditional abilities and I'd want to use a field_legacy_slug only if it exists, else use a standard token based pathauto pattern (site.com/2011-01-01/title-of-post)

I also don't think creating multiple alias' for content is advisable (aka letting wordpress url alias' exist beside the native pathautos) - but I am course asking you for insight into this :)

Creating node paths on import myself and allowing pathauto to catch new nodes seems like my only option but I'd hate for someone to run an "Update path alias" and ruin it all.

2

I believe the new-for-Drupal-7 Redirect module will provide what you need. Have not used it myself yet, but I used Path Redirect (which provides similar functionality for Drupal 6) to solve a similar problem. I generated a two-column table of values (old URL in one column, new URL in the other), and fed that to Path Redirect -- problem solved. Hope this helps.

  • This looks like exactly what I wanted! "Common API for loading, saving, and deleting redirects." - oh baby. Just need to add a new operation to my already large import bash script – electblake Mar 25 '11 at 22:12
1

You might want to look into Global Redirect. I use it to redirect all /node/### queries to the proper path. All the content could have the new URLs, but the old URLs would redirect to the canonical URL. This would solve your inadvertent 'Update path alias' problem, and also help with SEO magic.

  • I would agree with paxswill. If you are concerned that you may not achieve 100% coverage I would suggest also using the Search404 module to catch any missed urls. – irishbuzz Mar 24 '11 at 12:10
  • If it goes to a 404 it's too late, my search ranking will die along with the dead link, I'll look into the Global Redirect more though, thanks! – electblake Mar 24 '11 at 17:01
  • So to be clear - You are suggesting that I add 2 aliases - the wordpress url as well as the drupal alias? and global redirect to force the use of (or redirect away from) one of them? – electblake Mar 24 '11 at 17:04
  • Redirect the Wordpress URLs to node/<nid>, then let Global Redirect redirect node/<nid> to whatever you've set up as an alias in Pathauto. You could even use mod_rewrite to do the Wordpress->node/<nid> redirect, as it's just a one-time migrate. – cam8001 Mar 25 '11 at 3:47
  • I have around 2.5 thousand posts so it's not really viable to do mod_rewrite rules for each one... – electblake Mar 25 '11 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.