![]() |
redirect a user from a main controller - 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 a user from a main controller (/showthread.php?tid=79641) |
redirect a user from a main controller - Z4K7 - 07-13-2021 I am created a login project I am presenting a difficulty since at the time of the user entering the login, it is not redirecting to the web that I want but it remains in the login validator the file structures is yes PHP Code: <?php this is my main controller where I would give the whole body of the more controllers this is the login controller PHP Code: <?php PHP Code: $routes->get('/', 'Login::index'); It could help me what is the failure since if I place the redirection from the following way if it works PHP Code: <?php and it is addressed where I want to but I don't understand if I do it from the main controller and call that one, it works, it is not working, it could help me or clarify what is happening Thank you RE: redirect a user from a main controller - paliz - 07-14-2021 Use authentication filter to check whether use log in or not https://codeigniter4.github.io/userguide/incoming/filters.html Before function check user status You can not repeat code for every Ctl once for all RE: redirect a user from a main controller - superior - 07-14-2021 I've got to agree with @paliz on this one, the Filter is the best choice to accomplish this. You can always exclude certain pages to bypass the authentication part. |