CodeIgniter 4 redirect function not working
In codeigniter 4 redirect()->to() returns a RedirectResponse object, which you need to return from your controller to do the redirect.
for ex.
class Home extends BaseController {
public function index() {
return redirect()->to('https://example.com');
}
}
I use this and it works
return redirect()->to(site_url());
as per CI 4
use
return redirect()->to('url');
if you are using route then use
return redirect()->route('named_route');