Sharing content, users, and configurations across multiple Drupal sites

XAMPP has proven useful in creating multiple, uniquely named, sites on a local sandbox server. The primary motivation for this was to play with Drupal's Domain Access module. This module allows a single instance of Drupal to share content, users, and other configurations across multiple Drupal sites.

To start with, I edited C:\xampplite\apache\conf\extra\httpd-vhosts.conf and C:\WINDOWS\system32\drivers\etc\hosts to create the following domain names:

Only http://ignitesport.six is mapped to a Drupal installed, the other domains will be set up using the Domain Access module installed on http://ignitesport.six.


(Don't worry about the settings_*.inc files for now, we'll cover those later.)

1. Install the Domain Access module
Install Domain Access 6.x-1.2 by unzipping it into your modules folder. This provides a number of modules, all of which are dependent on the main Domain Access module. Installing this allows you to add domains:

The documentation can be found in a number of README.txt files. These will instruct you on how to edit your settings.php to use Domain Access. After installing Domain Access, I copied modules/domain/settings_custom_url.inc to sites/default, and appended the following to the end of sites/default/settings.php:

require_once 'settings_custom_url.inc';

2. Add the domains to be managed by Domain Access

Browse to the newly added domains (e.g. http://ignitegolf.six) which should be a fresh Drupal install.

3. Install Domain Access' Domain Prefix and Domain Themes modules
Installing these additional modules provides the functionality to share users, content, and themes across multiple sites. After enabling Domain Prefix and Domain Themes on http://ignitesport.six/admin/build/modules, I copied modules/domain/domain_prefix/settings_domain_prefix.inc into sites/default, and appended another line to the end of settings.php:

require_once 'settings_domain_prefix.inc';

4. This provides a few more configuration options on the Domain Access admin pages

Navigate to admin --> domain access --> table prefixing and leave everything to Igore, except for Node and Users, which should be set to Copy. This allows for users and content to be shared across the domains.

Update the users (admin --> user management --> users) and edit the users you would like to provide Domain access settings to.

Also, create or update nodes that you would like to share across domains:

Themes' settings can be applied from within Domain Access (admin --> domain access --> batch updating --> theme settings):

Browsing to the 'affiliate' domains now demonstrates individual Drupal sites, with their own themes, shared users, and shared content: