Multiple websites with drupal

drupal

Drupal is a popular content management system that offers an excellent mix of ease of use and flexibility. If I were to rank drupal, wordpress and serendipity in terms of flexibility then drupal would be number one followed by serendipity and lastly wordpress.

Drupal allows you to use a single copy to power multiple sites. This saves you disk space because you have just a single copy of drupal files that are being used by multiple websites. It also makes maintanence easier since you only have to update a single copy of drupal. In this post I look at how you can get additional sites to work with your drupal installation.

First step is to install drupal for your first site. Full instructions on how to do that are here.

Once you have installed drupal for your default or first site you can add additional sites using the steps in this guide:

Point domains to your drupal folder: Additional sites you want to install have to have the drupal folder as their document root. If your web hosting comes with a control panel then you can simply add domains and set your drupal folder as the document root.

Create a database for your new site: Create a database for your new drupal site and note the username and password of the new database.

Setup the site’s directory: Assuming that the site you want to host has the domain example1.com and your drupal directory is /home/www/drupal you would do the following:

  • Go into the sites sub directory
  • Create a sub directory example1.com (/home/www/drupal/sites/example1.com)
  • Copy the file default.settings.php from the /home/www/drupal/sites/default directory to the /home/www/drupal/sites/example1.com directory
  • Rename the newly copied file to settings.php
  • Change the permissions of the settings.php file in the example1.com directory to 777 (chmod 777 /home/www/drupal/sites/example1.com/settings.php)
  • Create a directory named files in the example1.com directory
  • chmod the files directory to 777

Now you can just visit example1.com and it will display the installation page. Proceed with installation like you did for the default site but make sure that you enter the details of the new database.

One thought on “Multiple websites with drupal

  1. Hi,

    I read your article, and would like to ask you for further help. I already have a single installation for a domain http://www.abc.com. Now I am trying to install another site for another domain http://www.bcd.com using the same codebase. Do I forward http://www.bcd.com to http://www.abc.com, and then do the install?.

    Your help is much appreciated.

    Thanks
    Krishna

Leave a Reply

Your email address will not be published. Required fields are marked *