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:

Comments

Can I customized each and every codes? I like learning this. Thanks fro sharing.
landscape photography

Mark (not verified) | Mon, 12/19/2011 - 14:44 |

great tut, have been looking for that for a long time tree removal cost

Guest (not verified) | Mon, 11/14/2011 - 20:34 |

Everything I have set up for the first site looks good on my installation, but in the second site, it's not showing the page node I created from the first site. Any ideas why this might be?
When I created the node, I made sure to select both sites in the dropdown list.

thanks

eric (not verified) | Fri, 04/23/2010 - 07:06 |

Very helpful site!!
However, I'm hitting a brick wall when I'm creating a story or a page. When I publish to a specified affiliate, it ended up publishing to all affiliates. I even made sure "Send to all affiliates" is unchecked. Have you seen this issue?

Thanks!

Guest (not verified) | Thu, 07/16/2009 - 09:19 |

My only guess is that you need to select 'send to all affiliates' & the domain you want to send it to. It seems the instructions are misleading (not sure if they've changed since I blogged this).

From http://drupal.org/node/320909, README should say:

If you select 'Send to all affiliates,' the node will be viewable on
all domains for your site.  Even if you select this option, you must 
select at least one domain for the node.
em | Tue, 04/27/2010 - 20:32 |

dude, m not sure u have found out the solution or not. But rebuilding the content permissions was the key for my case. It shows warning on top of the page to rebuild the content permission and that was it.
Hope it helps!

rohit (not verified) | Tue, 05/25/2010 - 05:02 |

Cheers Rohit!

em | Thu, 05/27/2010 - 00:07 |

I'm assuming you're referring to "2. Add the domains to be managed by Domain Access". From memory, I was able to successfully use subdomains for that configuration. If you're receiving an error message, submit an issue for the module developer with the details.

em | Tue, 01/13/2009 - 16:28 |

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <img /> <br /> <br> <p> <blockquote> <sub> <sup> <hr /> <hr>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options