[Drupal] How to install multiple domains in a single Drupal installation?

| | 1 min read

How can we install multiple domains or multi-sites in a single Drupal installation? We can install multiple domains in two ways:

  • Single database with different prefix(not recommended)
  • For each domain, use different databases

Steps to install multiple domains

  • Copy the "default" folder(sites/default) and rename it to say, 'yourfirstdomain.com'.
  • Inside 'yourfirstdomain.com' copy the default.settings.php and rename it to settings.php.
  • In settings.php add your database credentials.
  • Repeat the above steps for the second domain, with a different domain name .

Both domains will work perfectly, if you are not using boost module. If you have enabled the boost module, then when you try to access the second domain through browser, it will open the first domain content because of caching.

How can we solve this boost issue in multi domain installation?

  • In Boost configuration click on the file system menu. Change the root cache directory to the corresponding domain like 'sites/firstdomain.com/files/cache'
  • Click on the 'htaccess' tab. Change '.htaccess' setting, by selecting the first option %{HTTP_HOST}.
  • Copy the .htaccess generation rules content to your .htaccess file.

The above steps will help you to solve the cache problem.

Use multi-site only for sites having similar functionality, otherwise you have to create a separate installation.