fbpx

CodeIgniter 4 redirect function not working

After logout, I tried to redirect for the home page. I tried to few ways, but not redirected.

class User extends BaseController
{
    public function __construct()
    {
        helper('url');
    }

for the logout function. I used three ways

redirect('/');

or

header("Location:".base_url());

or

route_to('/');

1 Comment

Team CodeForHost (November 5, 2019)

as per CI 4

use

return redirect()->to('url'); 

if you are using route then use

return redirect()->route('named_route');

Leave A Comment

What’s happening in your mind about this post !