• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect problem with Ci4 Installed on sub directory

#1
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?
Reply

#2
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.
Reply

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.