Drupal 7 Multisite Setup

24 Nov 2017
Drupal 7

In this article we are explaining Drupal 7 Multisite and multiple Domain Setup. Drupal allows you to run multiple sites from a single Drupal code installation -- each with its own modules, content, theme, etc. If you are running more than one Drupal site, you can simplify management and upgrading of your sites by using the multi-site feature. Multi-site allows you to share a single Drupal installation (including core code, contributed modules, and themes) among several sites. And with help of the domain module of Drupal, you can create multiple domains, and can manage the contents based on domains.

Drupal 7 Multisite setup steps:

To create a new site using a shared Drupal code base you must complete the following steps:

  • Create a new database for the site (if there is already an existing database you can also use this by defining a prefix in the installation procedure).
  • Create a new subdirectory in the 'sites' directory with the name of your new site.
  • Copy the file sites/default/default.settings.php into the subdirectory you created in the previous step. Rename the new file to settings.php.
  • Complete the installation process.
  • Install the domain module of Drupal and create multiple domains.
  • Map each domain to the same code base, with help of virtual host.
  • In a Web browser, navigate to the URL of the new site and continue with the standard Drupal installation procedure.Drupal 7 Multisite

     

Site-specific modules and themes

Each site configuration can have its own site-specific modules and themes in addition to those installed in the standard 'modules' and 'themes' directories. To use site-specific modules or themes, simply create a 'modules' or 'themes' directory within the site configuration directory.

For example, if sub.example.com has a custom theme and a custom module that should not be accessible to other sites, the setup would look like this:

sites/sub.example.com/settings.php, sites/sub.example.com/themes/custom/theme_name, sites/sub.example.com/modules/custom/module_name

If you have multiple sites which have similar functionalities (use same modules or use the same Drupal distribution) in that case use Drupal 7 Multisite setup. For more Drupal 7 related articles visit here.