Welcome Guest, Not a member yet? Register   Sign In
set404Override inside Route Groups
#1

(This post was last modified: 05-14-2021, 08:02 AM by georgeynr.)

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.
Reply


Messages In This Thread
set404Override inside Route Groups - by georgeynr - 05-14-2021, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB