what happen is error with redirect to codeigniter 4.3.3 |
i have function below, but redirect() ->to('auth/home'); dont work, can someone show me what is error?
Code: 404 PHP Code: public function check(){ thank you for reading
Hi. Check if you have correctly set destination route auth/home in app/Config/Routes.php. It could be something like this:
PHP Code: $routes->get('auth/home', 'Auth::home'); You could also check if you have correct variables $baseURL and $indexPage in app/Config/App (or in .env file if you are using it), because redirect()->to() is based on these values. If it does not work, then try only redirection on a fresh CodeIgniter's installation. app/Config/App.php PHP Code: // ... app/Config/Routes.php PHP Code: // ... app/Controller/Home.php PHP Code: // ... Access this URL in a web browser (based on $baseURL): http://localhost:8080/from and watch if it is working. If it will work, then the problem is somewhere in your code or settings.
if you are using validation, it is pretty much sure you want to g back to the same page with the validation error in this case instead of using
PHP Code: return redirect()->to() PHP Code: redirect()->back() Code: php spark routes for more info check redirect-and-validation-errors
Learning Codeigniter
|
Welcome Guest, Not a member yet? Register Sign In |