![]() |
Same Installation folder for different sites (config.php and database.php) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9) +--- Thread: Same Installation folder for different sites (config.php and database.php) (/showthread.php?tid=61512) |
Same Installation folder for different sites (config.php and database.php) - lmartorell - 04-21-2015 Hi ! Someone has tested or configured, multiple vhosts (apache) ex: zone1.mydomain.com zone2.mydomain.com both documentroot points to the same folder but i need to have different config.php and database.php Some idea ? Thanks RE: Same Installation folder for different sites (config.php and database.php) - Rufnex - 04-22-2015 You can check what subdomain ist active and then make a switch in the config.php and database.php Somthing like this quick an dirty snippet PHP Code: $subdomain = explode('.', $_SERVER['HTTP_HOST']); RE: Same Installation folder for different sites (config.php and database.php) - mwhitney - 04-23-2015 If you can alter the server configuration to set a variable, you can always use: Code: SetEnv CI_ENV zone1 Of course, if you can't do that, you could still set the environment at the top of the index.php file using Rufnex' code to detect the subdomain. Once the environment is set, you can just add 'zone1' and 'zone2' to the list of environments in your index.php (to get the error reporting setup correctly) and load your config files from /application/config/zone1/ and /application/config/zone2/. |