[eluser]Bas Vermeulen[/eluser]
Hi,
What I did to have multiple sites running on one install is the following:
- index.php
- .htaccess
- system
- application (including the config folder)
- site1
-- index.php
-- .htaccess
-- public
- site2
-- index.php
-- .htaccess
-- public
site1 and site2 come with just an index.php and a .htaccess file and a public folder with images and css files. In the index.php files you can set the location of the system and application folders. In the same index.php file you can also add config items, these will overwrite the config in the application/config folder:
/site1/index.php
Code:
$assign_to_config['base_url'] = 'http://localhost/site1';
/site2/index.php
Code:
$assign_to_config['base_url'] = 'http://localhost/site2';
To be able to use a custom database connection per site I added the following to the index.php files:
/site1/index.php
Code:
define('DB_GROUP', 'site1');
/site2/index.php
Code:
define('DB_GROUP', 'site2');
In the application/config/database.php I set:
Code:
$active_group = DB_GROUP;
Then you can add the connection groups in the same file:
Quote:$db['site1']['hostname'] = "localhost";
$db['site1']['username'] = "username";
$db['site1']['password'] = "password";
$db['site1']['database'] = "database";
$db['site1']['dbdriver'] = "mysql";
$db['site1']['dbprefix'] = "";
$db['site1']['pconnect'] = TRUE;
$db['site1']['db_debug'] = TRUE;
$db['site1']['cache_on'] = FALSE;
$db['site1']['cachedir'] = "";
$db['site1']['char_set'] = "utf8";
$db['site1']['dbcollat'] = "utf8_general_ci";
$db['site1']['swap_pre'] = "";
$db['site1']['autoinit'] = TRUE;
$db['site1']['stricton'] = FALSE;
I hope this is what you were looking for?