redirect() does not redirects |
(09-06-2020, 11:09 AM)T.O.M. Wrote: "redirect()" does not make redirect - it is only returns prepared response for redirecting. For redirecting you need to "return" this response from executing method of the Controller. Yes it is described in the documentation. But it makes some inconvenience. You can improve the approach to your design, and completely avoid "en/home" etc. First ensure all text on your pages are actually from language blocks, then have translations for the languages you wish to support. Then automatically retrieve a users locale like this..https://codeigniter.com/user_guide/outgoing/localization.html?highlight=locale#retrieving-the-current-locale and automatically serve the user in his/her language or default if not available. For the redirect, you can create a helper function like this, and use it as you were using redirect in CI3. if(!function_exists('go')){ function go($route){ $str = base_url().'/'.$route; header("Location: $str"); exit(); } } Hope it helps |
Messages In This Thread |
redirect() does not redirects - by T.O.M. - 09-06-2020, 11:09 AM
RE: redirect() does not redirects - by SteeveDroz - 09-06-2020, 09:48 PM
RE: redirect() does not redirects - by chenzen - 09-06-2020, 11:42 PM
RE: redirect() does not redirects - by T.O.M. - 09-07-2020, 03:36 AM
RE: redirect() does not redirects - by T.O.M. - 09-07-2020, 03:21 AM
|