Peter, this does seem like a job for Apache or Nginx URL rewrites. Do you have access to your server at a level that allows rewriting the URLs?
If you do, you could rewrite the appropriate URLs to move the “dynamic” part of the URL into a parameter and deal with it more easily.
Another alternative, if you don’t have access to the rewrites of your server, is to handle the problem in the 404.php script of your theme. When WordPress fails to find the correct page, it will call the 404 script. In that script you can include code to look for your special case and handle it.