How can I redirect in Controller? |
Skip 'return' and you are good to go.
https://www.codeigniter.com/user_guide/h...t#redirect
Hi Jreklund,
I'm sure you give me a document of CI version < version 4. This is CI4, this is the document of CI4 https://bcit-ci.github.io/CodeIgniter4/. Maybe, I need a help from the constructor, this is a bug, I think. Thankyou!
The way you're using it used to work, but it was reworked a bit ago and that usage might have broken. See the examples in the docs but the quick version is:
Code: return redirect()->to('somewhere');
Hi,
I have test in other hosting, it works with two method redirect('somewhere') and redirect()->to('somewhere'). Maybe, I have problem with this hosting. I'm sorry about that. But I have another problem, the redirect always redirect to base URL. Example: The base URL: https://mydomain.com/path/ I want redirect https://mydomain.com/path/admin to https://mydomain.com/path/admin/login if not logged in. My redirect code is PHP Code: return redirect()->to('admin/login'); I think I defined $baseURL correctly. PHP Code: public $baseURL = 'https://mydomain.com/path/'; Thanks! (01-25-2018, 06:25 AM)iceleo Wrote: I'm sure you give me a document of CI version < version 4. This is CI4, this is the document of CI4 https://bcit-ci.github.io/CodeIgniter4/. Maybe, I need a help from the constructor, this is a bug, I think.Didn't look at the sub forum on this one. Haven't started using CI4 yet, so can't be of any help here. Sorry for popping by. :-)
I have the same problem on CI v4.0.0rc3.
My .env file is configured as follow. Code: app.baseURL = 'http://localhost/path/' My controller calls the following function. PHP Code: return redirect()->to('catalog'); I'm redirected to http://localhost/catalog instead of http://localhost/path/catalog. How do I fix it? Thanks. |
Welcome Guest, Not a member yet? Register Sign In |