Drupal is an incredible CMS that has a lot of extremely useful features. I’ve written about many of them in my previous blog posts. In this post, however, I’ll be focusing on a relatively new feature that could prove to be very useful for many people- Drupal multisite. Popular CMS such as WordPress already offer this functionality to their users. It is important for Drupal developer to know how to setup Drupal Multisite for your projects.
Who Needs It?
Multisite is a feature that allows you to set up multiple websites with the same code base. All these sites will contain the same core, themes, and modules. Possible scenarios that could benefit from Drupal multisite could be:
- If you have several sites that are all similar in functionality. In this situation, multisite is a great solution for easier management of all the websites.
- If you need multiple sites with the same core, modules, themes or distribution.
- If you have limited resources and/or limited workforce and a lot of sites to manage.
Install and Setup Drupal Multisite
Installing and setting up multisite isn’t as simple as other Drupal features, however, the following instructions should have the multisite feature up and running perfectly. Let’s dive into setting up a new site with a shared code database:
- First, create a new database for your site. You can also use database prefixes for this purpose.
- Next, you will need to create a new subdirectory in the sites folder. Note that the settings.php config file for this site will be located inside this new subdirectory i.e. sites/multisite.com/settings.php. So your site ‘www.multisite.com’ will be housed in the sites/multisite.com directory. Also, note that in order to run your multisite off subdomains, you should name your directory like this: subdomain.example.com.
- Now copy the default.settings.php file from sites/default/ directory and copy it to your new site’s directory, renaming it to settings.php.
- Before proceeding to install the site, you will have to change the permission of the settings.php file(copied earlier) to be writeable. Since there is a chance that moving the file to another subdirectory could change the permissions, it is a good idea to manually change the permissions to 644 [-rw-r–r—]. If you skip this step, there is a real chance that the installation will fail.
- If you are running your subsites off a subdomain, you most likely won’t encounter any errors. However, if you are running off subdirectory you might encounter an error. In order to circumnavigate this error, you have to create a symbolic link to your sites. In order to do this, simply navigate to your site’s directory and type the following command: ln -s . site 1.
- Go to your website and navigate to your site’s URL to install the site just like a normal Drupal installation.
That’s it! You now how to setup Drupal multisites. Say goodbye to having to set up similar sites from scratch and say hello to this awesome feature! After all, time is money and when you save time, you save money. If you liked this blog post, then you should definitely read another blog post by us on, Embedding Videos On Drupal 8 Websites.
Start Growing with Cloudways Today.
Our Clients Love us because we never compromise on these