As a point of reference there are some redirection scripts for vBulletin we wrote for XF1 and then we did a direct port of those for XF2.
That should give you an idea of the changes required. There are some syntactical changes required but the general logic is pretty much identical. Should be a good starting point.