I recently moved content from Typo3 to WP with around 30.000 articles. Each article is having 3 or more urls which I store in custom text field.. each old url in new line.

I can programatically pair each stored old typo3 link to wordpress link but the question is how to manage 301 redirects without pasting some output to .htaccess. 

My idea is something like:

1. Call <http://www.domain.tld/old-link/>
2. (normally this hits 404) wp compares requested old link with all meta fields "\_old\_urls" and if found
3. 301 redirect and wp serves new url

Any idea how to do that?