2

I'm planning to migrate the content from my existing legacy system to drupal. In process there are a lot of static pages, nodes and taxonomy terms which have hyperlink references to the legacy URLs that cannot be replaced with current URLs due to their sheer magnitude and for which redirects cannot be set manually (i'm using path_redirect module to handle redirects, atleast I intend to).

So my idea of implementing this by redirecting my legacy URLs in my .htaccess to handle them in a custom module where the drupal URL is deduced based on the URL and its params and redirect them. Also add an entry for them with HTTP 301 in path_redirect table so that next request I could check for the entry before proceeding to programmatically determine the node/page URL again. I skimmed the module code which seemed to use hook_init to work the redirections and it seemed feasible in theory, though i'm not sure of the results in practice.

Hence I wish to know if this idea is sensible or if it has some flaws as I'm not an expert in the areas of URL rewriting or SEO. Also I'd request anyone with practical experience on the same to know of any challenges involved in this.This served as a reference before I decided to post my query.

5
  • Does the domain name stay the same or does it change?
    – uwe
    Commented Apr 26, 2012 at 16:18
  • @MotoTribe for now i believe its the same.. Commented Apr 26, 2012 at 18:35
  • can you give some examples of the legacy paths and your expected new drupal ones?
    – Jimajamma
    Commented Apr 26, 2012 at 19:13
  • @Jimajamma unfortunately i can't... don't have much of the details with me, that's why i couldn't post any code.. but legacy URL paths are worlds apart from the drupal ones... drupals path are more or less regular ones generated by pathauto like content/[content-title] Commented Apr 26, 2012 at 19:25
  • 1
    The reason I ask is one of my insane "what ifs" but assuming these links are in some text fields/areas/fields of nodes, instead of a redirect module, you created a filter that when it found an old url it did the conversion so that the old one was never presented. And, to fly in the face of drupal's don't save filtered output in the database, it could even save the new filtered url back into the node so it wouldn't have to do it again the next time around, and, then, after time, your system would "self clean" itself up.
    – Jimajamma
    Commented Apr 27, 2012 at 1:43

2 Answers 2

2

I've just done a transition like you mentioned and the domain names changed. I didn't want the old urls hitting my drupal server so I setup a 2nd site just for redirects. At first I had a simple php redirect script that would map old urls to Drupal urls. The mapping came off the "migrate_map" tables that the migrate module generated.

Then someone on the team was concerned about the immediate SEO impact and preferred to keep the old site content available at the old domain name. So I copied the new Drupal site to a 2nd hosting account.

I added a "custom404" module which uses hook_init() to read the URI, detect a pattern, find the unique key in the uri, then lookup the Drupal nid using the migrate_map table and then use drupal_goto() to do a 301 to Drupal URI.

On that Drupal site I show a "website has moved" message with a link to the same URI on the new domain. Pretty soon I'll change my script to just 301 redirect to the new domain directly.

I was initially toying with the idea of using a lower bootstrap level (to have faster redirects) but ran into issues with database connections. Got some great help here about that.

1

This is quite a specific example, but hopefully it helps.

I moved a site to Drupal that had legacy 'item' (node) URLs that could be any of the following:

  • cgi-bin/item.cgi?id=12345
  • cgi-bin/item.cgi?id=12345&d=1&h=2
  • item/12345
  • item/12345/1/2

To preserve these URLs, the site alias on the imported node was set to item/12345 and the code below was added to the vhost.conf to handle the redirection

RewriteCond %{QUERY_STRING} id=([0-9]+)(.*)
RewriteRule ^cgi-bin/item.cgi /item/%1? [L,R]
RewriteRule ^item/([0-9]+)/.+ /item/$1 [L,R]

I've quite a bit of experience migrating sites to Drupal and between Drupal versions, keeping an eye on the SEO impact. It might be that you don't have to redirect all URLs. Since the publishing titles I have worked with have inbound links almost entirely at nodes or the homepage, I have only preserved their URLs. I've totally changed structural pages addresses and not only avoided a drop in SEO traffic, but have seen positive changes in that area.

I'd suggest you look in Google web master tools to see which pages your inbound links come to and make sure you accommodate those pages in your solution. You could also check in Google analytics to see if a substantial amount of traffic comes to you from specific sites.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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