Tuesday, August 18, 2009

How to Setup Drupal for Multiple Sites

How to Setup Drupal for Multiple Sites

Drupal is a very powerful open source content management system
. And one of the most attractive features from Drupal is that it will allow you to install one single Drupal code base which can serve for multiple web sites, each with its own individual configuration.

But unfortunately, the guide from Drupal office site on how to configure this feature is not clear enough, and the beginner might be lost during it. In below, we will provide you with the step by step guide to set it up:

Before we start, you should have successfully install one Drupal instance, if you still haven't, please follow the installation guide
from Drupal official site to get it setup. Here, we will focus on how to add another domain to one Drupal installation.

* Create a new database and database users for the second domain (lets call it as "domain2.com")
* Grant full privileges to the database to the user created in the step 1)
* Create a sub-directory in the "/sites" directory call "domain2.com", it will look like /sites/domain2.com/. Please don't include 'www' in the sub-directory.
* Copy the /sites/default/default.settings.php to the new directory /sites/domain2.com/settings.php (don't forget to remove the 'default.' from the file name)
* Setup the add-on domain for "domain2.com" in your web hosting account. For a shared web hosting environment, domain2.com will point to a directory like "/home/username/public_html/domain2".
* Delete directory "/home/username/public_html/domain2"
* Create a symlink to the main site as "/home/username/public_html/domain2", the same as what in above.
* Launch the domain2 in browser, Drupal Installer will be launched, go through the installation process
according to on-screen instructions. You will get new web site setup on the same Drupal code base.

No comments: