Today, I was exploring CI 4 and I got stuck while setting custom 404 error inside route group.
PHP Code:
$routes->group('admin', function ($routes) {
$routes->add('page', 'Welcome::index');
$routes->set404Override(function () {
echo 'Not Found admin';
});
});
$routes->group('user', function ($routes) {
$routes->add('page', 'Welcome::index');
$routes->set404Override(function () {
echo 'Not Found user';
});
});
When I hit /admin/123 url, I should get 'Not Found admin'. Instead what I am getting is 'Not found user'. Can someone please help me what I am doing wrong or is it a bug? How can I manage to get separate 404 errors based on Route Groups.