Search code examples
routescodeigniter-4

Ci4 redirecting routes


I am trying to use redirect in Ci4 and it is not working (loading an empty white page)

In the controller i use the redirect function as follows: redirect()->to('login')

And in the routes.php file i have the route named as follows: $routes->get('login', "Home::login");

When i go with the browser directly to where i should land the page is loaded so it is not a page problem. Secondly in the debug bar since i am in development in the routes tab i can see the route defined


Solution

  • I have found the problem.

    I have omitted return and additionally (for whoever lands here) if you are finding index.php in the uri and you are using mod_rewrite be sure that in app.php you have public $indexPage = '';