How to replace links and embedded image references after migrating of content I want to import content from a legacy system into Drupal using the migrate module. The URL structure is going to change.

Some of the content has links pointing to the old content and there are also embedded images with soon to be outdated links.

After migrate is done I'll have a mapping from old urls to new urls and should be able to run a custom script. This script would check for all nodes with old urls and replace it with the new urls and then just node_save() it.

Is this a good approach or is there a better solution?

Btw, I'm also planning on setting up a simple php site under the domain to 302 redirect old urls to the new url.
Writing a script that does a node_load(), search/replace, and then node_save() is definitely the best way to go about it, and I would argue that it is also the "proper" way to handle the situation.  If you go with this approach, you can refine and/or alter the script each pass to account for differences in the URLs.

In the past, I have


Use rewrites in .htaccess
Done search/replace on a database backup file
Put search/replace in a preprocess_page


to handle the situation, and all of these are not ideal, mainly because of slight variations in URL structure.