Well, basically like this then
c::set('routes', array(
array(
'pattern' => '(:any)',
'action' => function($uid) {
// check if the page exists
$page = page($uid);
// then check here each level, so first industries and then each other level and the same for all other pages that have subpages
if(!$page) $page = page('industries/' . $uid);
if(!$page) $page = page('industries/life-sciences/' . $uid);
// etc.
if(!$page) $page = site()->errorPage();
return site()->visit($page);
}
),
array(
'pattern' => '(:all)/(:any)',
'action' => function($uri,$uid) {
go($uid);
}
)
));
Keep in mind that you have to make sure that none of your pages on any level use the same URL, otherwise some of your pages won’t be accessible anymore (for example, if any of the subpages in one of the trees had the same UID as a subpage of one of the other page trees).