Welcome Guest, Not a member yet? Register   Sign In
Redirect() ignore baseURL?
#1

I have some troubles with the redirect function.

I test my code with MAMP on my Mac. I don't want to set up multiple subdomains so I have multiple CI4 installations in subdirectories like this:
http://localhost:8888/ci4-test1/public/index.php
http://localhost:8888/ci4-test2/public/index.php
http://localhost:8888/ci4-test3/public/index.php

I submit a form to this URL:
http://localhost:8888/ci4-test1/public/i...ler/save/1

...after the data is updated in the database, I want to redirect to:
http://localhost:8888/ci4-test1/public/i...bum/edit/1

But here is my problem. It redirect to this URL and gives a 404 not found error:
http://localhost:8888/some_controller/edit/1

In .env I set the baseURL like this:
app.baseURL = 'http://localhost:8888/ci4-test1/public/'

In my controller I do the redirect like this:
return redirect()->to('/some_controller/edit/' . $id');

What am I doing wrong? Why is the directory name 'ci4-test1/public' not in the destination URL?
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
Redirect() ignore baseURL? - by includebeer - 04-22-2019, 02:11 PM
RE: Redirect() ignore baseURL? - by MGatner - 04-22-2019, 03:11 PM
RE: Redirect() ignore baseURL? - by includebeer - 04-22-2019, 03:30 PM
RE: Redirect() ignore baseURL? - by donpwinston - 04-22-2019, 05:02 PM
RE: Redirect() ignore baseURL? - by includebeer - 04-23-2019, 08:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB