CodeIgniter Forums

Full Version: Redirect problem with Ci4 Installed on sub directory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.
I am using the latest CodeIgniter-4.0.0-rc.3.
Will try to use the development branch.
Thanks