CodeIgniter Forums
muti domain support. - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: muti domain support. (/thread-72736.html)

muti domain support. - admin0 - 02-04-2019


In CI3 , it was:

    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
    $ssl_set = "s";
    } else {
    $ssl_set = "";

    //$config['base_url'] = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST'];

in CI4, if statements do not seem to work and give a 500 error.
What is the best way to use/detect multiple subdomains/domain ?

    public $baseURL = ??

The SaaS application that I am trying to port from CI3 works like ..   -- can also be mapped to 

I am checking how to achieve the same in CI4 ?


RE: muti domain support. - kilishan - 02-04-2019

Config classes are just that - classes. That means that setting class variables needs to be done in the class constructor.

RE: muti domain support. - puschie - 02-11-2019

we faced the same problem - our solution/workaround was to implement "array support for baseURL"

Here is our PatchDiff

how it works:
detection function in common.php

replace all baseURL usage by detection function in:

hope it can help you