CodeIgniter Forums
CI4 Base URL Behavior - 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: CI4 Base URL Behavior (/showthread.php?tid=73946)



CI4 Base URL Behavior - donpwinston - 06-26-2019

CI4 used to figure out the base URL all by itself. Now it doesn't even try. I get an error if I don't specify it. Why is this?

I have development, testing, staging, and production environments. I have to maintain separate .env or App.php config files for each environment. 

Also, more importantly we play games with the URLs. For example on our Drupal sites we have the same code/server running under prod-bnc3-web6 and bnc.uscourts.gov. And it works if you just stick to relative URLs. Why can't I do this with CI4? It appears when I do a redirect the URL is changed to whatever the base URL is set to in .env or App.php. This is appears to be a problem.


RE: CI4 Base URL Behavior - kilishan - 06-26-2019

By default it forces you to set a base url as a security measure. There's nothing stopping you from modifying the config file to scope out the current domain and use that. I've seen that done on a lot of CI3 sites in the past.