CodeIgniter Forums
Redirect problem with Ci4 Installed on sub directory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Redirect problem with Ci4 Installed on sub directory (/thread-74972.html)



Redirect problem with Ci4 Installed on sub directory - vincent - 12-02-2019

I am new to CI4

My Ci4 installed with this
Code:
public $baseURL = 'http://localhost/ci4/';

When I try to redirect
Code:
return redirect()->route("admin/category");

It redirects to :
Code:
http://localhost/admin/category

instead of
Code:
http://localhost/ci4/admin/category

My workaround is to comment this line on route() method on RedirectResponse class
Code:
//$route = $routes->reverseRoute($route, ...$params);

Because this line adding slashes in front of route, make the route becomes
Code:
/admin/category

makes base_url("/admin/category") returning
Code:
http://localhost/admin/category

But it returns the right uri when calling base_url with this (without slash in front of the route)
Code:
base_url("admin/category");

I don't know if it is safe for me to comment that line.

Or am I doing something wrong?


RE: Redirect problem with Ci4 Installed on sub directory - MGatner - 12-03-2019

What version of the framework are you using? URLs and subdirectories were reworked recently, so if you aren’t using the latest development branch you should test that first.


RE: Redirect problem with Ci4 Installed on sub directory - vincent - 12-03-2019

I am using the latest CodeIgniter-4.0.0-rc.3.
Will try to use the development branch.
Thanks