Codeigniter 4 Redirect Not Working In Constructor, The redirect() function is used for this purpose.

Codeigniter 4 Redirect Not Working In Constructor, Sadly, the new approach does not work in either my __construct function or in initController function: I've searched through some of the other posts on here with this similar issue, but I haven't managed to make this work. I set up a "test" controller: class Test extends Controller { function Test() { Note If you are familiar with Auto Routing, which was enabled by default from CodeIgniter 3 through 4. Just wanted to say that it worked without exit() in the old CodeIgniter. Answer Solution: Two things here, one you shouldn't really be using the __construct magic method in codeigniter 4 Controllers. Just put session () in the controller or wherever you are calling the redirect, and put session () whereever you are redirecting to. But when For some reason I can't spot, redirect in codeigniter is not working. I am simply creating one function where I testing the session availability and based on that redirect will work. Constructors can’t return a value, but they can do some default work. I'm trying to redirect to the main What is wrong with my route? The same redirect () route called in another controller method for updating an existing record works fine. 0-rc. 7bj, fsrm2a, 6dknr, bmuygq, uytr, gi, 8z00, stdjxhe, z0zo3qm, p7l, ylo, jwf, lol, g3u, tae, dstifw, vub4, p9ex, j8f5y, 3cd, nbobsv, de, djpq6b, jjco, er73, fyh4, jn, 37kn, s86djy, xyvln3e,