[Drupal] How to set up and configure multiple sites using multisite in a single drupal 6 installation?

| | 2 min read

Multisite concept allow us to run multiple sites in single drupal core installation . Each site in the multisite will have it's own modules and themes as well as files folders. Setting up multiple sites like this will save on patch administration, permissions administration, setting up APC etc. Follow the below steps for running multiple sites in single drupal installation.

  1. Install the Drupal core a standard Drupal 6 installation. Suppose this site is site.com
  2. Create new database for your second site site2.com running along with above site.com drupal installation.
  3. In multisite some tables can be shared between all the sites. Create 1 database for storing these shared tables.
  4. Create a sub directory in 'sites' directory folder and named as your second site site2.com. Copy the file sites/default/default.settings.php in to site2.com subdirectory and rename it as settings.php. Change the settings.php file variables $db_prefix and $db_url.
  5. Set the $db_prefix variable as,
    $db_prefix = array( 
    'default' => '', 
    'users' => 'shared.', 
    'sessions' => 'shared.', 
    'role' => 'shared.', 
    'authmap' => 'shared.', 
    'sequences' => 'shared.', 
    'users_roles' => 'shared.', 
    'permission' => 'shared.', 

    where 'shared' is the shared database name and users, sessions, etc are the shared table names. You can decide to have fewer shared tables or no shared tables as well.

  6. Set the $db_url variabls as,
    Eg:$db_url = 'mysqli://username:password@localhost/databasename';

    where 'username' is the database user name, 'password' is the database user password and 'databasename' is the corresponding site database name.

  7. Newly created site can have its own themes and modules. Create themes and modules directory in site2.com subdirectory and share its own themes and modules. All modules and themes present under sites/all will be available to all sites in the multisite installation. Modules and themes under the sites/site2.com/ folder will only be available to the site2.com site.

Your site2.com configuration is done successfully . Now you can continue with the standard Drupal site configuration procedures. Similarly you can create more sites in the same drupal installation.