matching path rewrite without htaccess I need to move a legacy Drupal 7 site to our new Aegir hosting environment. Unfortunately, the file structure is "non standard". I need to move drupal/materials to drupal/sites/default/files/materials but also need a corresponding path rewrite or redirect .htaccess or http.config is not an option, I need to do it in Drupal.

Redirect module does not do tokens or wild cards. Match_redirect module does not rewrite, but matches on a many to one bases. A rewrite would be better than a redirect.

I cant seem to find an existing contrib - how would I do this in PHP with the Drupal APIs? Would I want to use hook_boot or hook_init?
If you have some control on the Aegir instance, and 100% trust your users that have sftp/ssh access to your site, you could use the provision_customhtaccess module:
https://github.com/mlutfy/provision_customhtaccess

This makes it possible to have a "htaccess-custom" file in your sites/example.org/ directory that will get included in your vhost configuration. However, it is a big security risk if you do not trust your users. They can close a vhost declaration, open a new one, do many bad configurations, etc.

Alternatively, if you're going to write a new module, it seems pretty easy to add in the match_redirect module. There is a feature request open, so I am sure the community would appreciate. Worst case, you can offer the maintainer to sponsor the development:
https://www.drupal.org/node/2118233

You can see how drupal_match_path() does a match and use that to rewrite the target redirect:
https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_match_path/7