How to move site and switch link structure using HTTP 301 redirect

view story

http://serverfault.com – I currently have my wordpress blog (apache2, ubuntu linux) hosted at e.g. mysite.com using ID-based linking, e.g. http://mysite.com/?p=547. I have two goals: move my blog to mysite.com/blog change the link structure to /{post-title} instead of /?p={post-id} Moving to the new structure should be simple enough, as is changing the setting in wordpress to use the new permalink structure. What I would also like to do is not break the random(1..100) sites that currently link to me. I would like to use an HTTP 301 permanent redirect, but I'm not sure how to do that by changing apache's settings (HowTos)