How to setup drupal multisites

By | May 30, 2016

Drupal Multisite:

Using Drupal we can run multiple websites with single source code, so we are going run a multisite with share code base but each site going to run with separate database so each site having a separate database, separate configuration, content, settings and themes. The codebase only going to be shared between all sites. This will be useful when you have to manage many sites, so you will handle single codebase ( i.e Drupal Core files ) , instead of update everything you going to think about the drupal core files suppose if you need to update your drupal core.


To create a Drupal multisite, complete the following steps:

1. Create a new databse for each of your multisite, so I have created three databases, since I am going to have a three sites so I am going to create three database. One is for main codebase (drupal7) and 1.Multisite1 and 2. Multisite2 is for shared code base


2. Create a new sub directories under sites folder in your drupal main setup. I have created multisite1 and multisite2 is a newly created sub folder.


3. Within that sub directory copy the default.settings.php and put into this folder and rename it into settings.php.

4. Now you have to add your domain entry in “Apache “ Virtual host file. This is the path for apache vhost in my local setup with XAMPP environment – ‘D:\xampp\apache\conf\extra\httpd-vhosts.conf’ files.


This is what I have added in the Virtual host file, so here I added all the three virtual host entry in the Apache httpd-vhosts.conf file.

DocumentRoot "D:/xampp/htdocs/drupal7"
ServerName localhost.multisite
ErrorLog "logs/localhost.multisite-error.log"
CustomLog "logs/localhost.multisite-access.log" common

DocumentRoot "D:/xampp/htdocs/drupal7"
ServerName localhost.multisite1
ErrorLog "logs/localhost.multisite1-error.log"
CustomLog "logs/localhost.multisite1-access.log" common

DocumentRoot "D:/xampp/htdocs/drupal7"
ServerName localhost.multisite2
ErrorLog "logs/localhost.multisite2-error.log"
CustomLog "logs/localhost.multisite2-access.log" common

5. I have add a proxy in my local machine , so that I am able to call the localhost.multisite , localhost.multisite1 and localhost.multisite2. You can add proxy in any of the browser, I have used chrome browser, here the screen shots for the proxy entry to your browser.


6. Also you need to enter your domain entry in your local machine hosts entry. You can find this file in your windows machine in this path “C:\Windows\System32\drivers\etc\hosts ”. I have added three domain entry in this hosts file.


7. Now you have all set to run your drupal installation wizard. By calling http://localhost.multisite1/install.php this path will give you a standard drupal installation, when you provide your database information enter the correct database name in the database setup wizard screen, here the screenshots when I have done the multisite drupal setup.

8. Like wise you can create another installation by calling this path http://localhost.multisite2/install.php






Speak Your Mind