![]() |
Redirect issue - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Redirect issue (/showthread.php?tid=87872) |
Redirect issue - Zeff - 06-12-2023 Dear all, I have a strange issue when I use the return redirect()->to() function: In my controller; I have this method: PHP Code: private function _check_login() PHP Code: $routes->add('not_allowed', 'Issues::not_allowed'); Neither way of redirection (via 'route' or 'to' works), the code just continues no mather if the user is logged in or not. If I uncomment the die('Not allowed') line, it works (scrips stops). Can anyone explain this behaviour? What am I doing wrong? Many thanks in advance! RE: Redirect issue - kenjis - 06-12-2023 You need to return the Response object from your controller. You return it from the _check_login() method, but do you return it from the public method? RE: Redirect issue - Zeff - 06-12-2023 (06-12-2023, 03:59 AM)kenjis Wrote: You need to return the Response object from your controller. Hi kenjis, it's obvious indeed but I missed that one. Many thanks! |