I'm sure this was discussed before. In converting vB to XF, category pages are created. Unfortunately there seems to be an inherent conflict and I can't think of a resolution other than hardcoding 301 redirects for every category. It appears that forumdisplay.php may be used for forums that are categories. But in XF, the "categories" slug and "forums" slug while vBulletin just uses "forumdisplay.php" without differentiating one from another, just parent and child. So some will redirect incorrectly because the script will be set to redirect forumdisplay to only one variation. So this would need to be manually coded as a conditional so that the forum numbers that are categories, e.g. f=40, f=34, etc. are filtered out of the redirect to forums and are properly redirected to categories.
I've seen this asked before and no answers. So using my very limited Regex skills and ability and hacking by observation, using this structure by listing out your category IDs will work. You don't have to list your forums which will be automatically redirected underneath as such: