CodeIgniter Forums
Issue with Routing: My fault or Bug? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Issue with Routing: My fault or Bug? (/showthread.php?tid=74357)



Issue with Routing: My fault or Bug? - webdevron - 09-15-2019

My base URL is:

PHP Code:
public $baseURL 'http://example.com/public/'

echo base_url() prints <?=base_url('manage/update-content/home/')?>

return redirect()->to('/manage'); redirects me to http://example.com/manage/. It excludes the /public segment.

<?=base_url('manage/update-content/')?> prints http://example.com/public/manage/update-content/ but behave like http://example.com/manage/update-content/

The issue is only with the '/public' segment. This segment excludes every time.

Am I doing anything wrong?


RE: Issue with Routing: My fault or Bug? - ciadmin - 09-15-2019

Your baseURL should not include "public" - that should be handled in your web server setup.
Your document root should be set to PROJECT_FOLDER/public.
Your baseURL would then be 'http://example.com'
And redirecting to '/manage' should go to the right place.

The way you have it configured, the browser thinks you are in '/public/manage/...', and redirecting to '/manage' is behaving as it should given this.