Same Installation folder for different sites (config.php and database.php) |
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
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']);
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/. |
Welcome Guest, Not a member yet? Register Sign In |