how to separate config.php, database.php, constant.php file domain specific in codeigniter v3.1.10? how to separate config.php, database.php, constant.php file domain specific in codeigniter v3.1.10? codeigniter codeigniter

how to separate config.php, database.php, constant.php file domain specific in codeigniter v3.1.10?


as per your requirement, you want multiple subdomain configu. e.g for subdomain abc.exmaple.com want to load abc config folder. for subdomain xyz.exmaple.com want to load xyz config folder.

in your index.php

$env= 'development';list($subdomain,$host) = explode('.', $_SERVER["SERVER_NAME"]);$allowed_subdomains = ['abc','xyz'];$env = in_array($subdomain,$allowed_sbudomains) ? $subdomain : $env;define('ENVIRONMENT',$env);

in switch..case below as a case for your subdomain

switch (ENVIRONMENT)   {     ...     ...      case 'testing':     case 'production':     case $subdomain:     ....   }

now create a folder as per your subdomain under the config folder and do your required configuration there.