Dynamic routing question

I’m writing my own script to migrate from wordpress to Ghost. The problem that I’m facing is that in wordpress permalinks include all categories, for example, if a post has “news” and “from partners” categories, then the post address gets /news/from-partners/ in it’s url. I managed to set all posts to use the primary tag as the first part of the url, but what to do with the second one?

To clarify, some posts have one category, some have two

someone, please? this is a breaking change((
I’m thinking I can redirect all links with “from-partners” to just news… Will try that

come on, how hard could it be? what’s he point of the CMS if you can’t create a url that you need?!