Heyho,
I re-route my error pages not to an specific error-page but my home-page with appended data with indicates the error. I got nearly everything to work. The following links successfully route to error pages:
site.com/blablabla
site.com/items/blablabla
site.com/items/blablabla/blablabla
The only type of links which deliver only a blank page and don’t route to the error are:
site.com/blabla/blabla
I’ve appended my router-code. I already tried to replace the (:any)
in the first route with (:all)
but then not even site.com/blablabla
displays an error but only a blank page
c::set('routes', [
// - Redirect 'items/' to the root '/'
// - Send error-page to home with appended data
[
'pattern' => '(:any)',
'action' => function($uid)
{
$page = page($uid);
if ($uid == 'items') go('/');
if ($page) return site()->visit($page);
return ['/home', ['error' => $uid]];
}
],
// Redirect external-link items to their destination
[
'pattern' => 'items/(:all)',
'action' => function($uid)
{
$page = page("items/${uid}");
if ($page && $page->isExternalLink()) go($page->externalLink());
if ($page) return site()->visit($page);
return ['/home', ['error' => "items/${uid}"]];
}
]
]);
Thanks as always!