
- Drupal 9 multisite how to#
- Drupal 9 multisite install#
- Drupal 9 multisite full#
- Drupal 9 multisite code#
(Do NOT try to circumvent the symlink step by creating the document root for your subdomain in sites/. ): in cPanel, go to Subdomains, add your subdomain, and for Document Root, create a directory directly in in public_html. This will create a directory in public_html/mysecondproject. ): log into cPanel, go into Domain Manager and add a domain as an addon (NOT parked).
Drupal 9 multisite full#
Create a user (or use the same user you assigned to your main Drupal install) who has full permissions to the database. Create a database for the second site, the same way you did for your main Drupal install.
Drupal 9 multisite install#
If your main Drupal install is in another directory, modify the directions accordingly- for instance, where it says "public_html/sites", instead go to "public_html//sites": when you open the public_html directory, you see folders like "sites", "modules", "profiles" and files like "install.php" and "index.php"). This assumes that your main Drupal install is directly in the public_html directory (i.e.
Drupal 9 multisite how to#
Now for the specific steps for how to make this work. Now when you go to, the server looks for the folder it created for the new site, the symlink redirects it to the to the main Drupal directory you set up for your first site, then the sites/sites.php file directs it to the folder that corresponds to your second project’s files.In your Drupal sitesfolder, create a directory for your new domain.the one you’ve already set up for your first site). You need to remove that directory and create a symlink (like a fake directory that redirects to a real directory somewhere else) in its place that points to the main Drupal install (i.e.When you go to, the server looks in that /home//public_html/newdomain directory for what it should display.When you create a subdomain or assign an add-on domain in cPanel, a directory is created in /home//public_html for that subdomain or add-on: /home//public_html/newdomain.$sites = 'example1.If you’re hosting your site(s) using inexpensive shared hosting that uses cPanel as the interface for server configuration, you can use the steps below to set up a Drupal multi-site. * Edit the lines below to define directory aliases. Rename to sites.php, then uncomment and change the $sites array as needed. The sites.php is stored in the sites directory, if you have installed Drupal 7 you should see a file called. Luckily this issue has been fixed in Drupal 7 thanks to the sites.php. When you have specific modules and themes within those site directories, managing the codebase with a version control system becomes very painful. If your local URLs are “example1.localhost” and “example2.localhost”, then you’ll also have to create a folder within the sites directory. The same applies when you create a local development version. Open the in the default folder for a more detailed explanation. If a folder is found it’ll use the folders settings.php to load the site. When Drupal gets bootstrapped, it’ll look for a directory in the sites folder which matches the URL.

Your sites directory should look like the following: You can place themes and modules within the specific directories and they’ll only appear on those sites. All you would have to do is create two directories called “” and “”, then create a file called settings.php in those directories and you’re done. On a production server the URLs never change, but if you want to create a local development version of your multi-site setup that’s where things get complicated.įor example, if your site domains are “” and “”.
Drupal 9 multisite code#
Site builders are able to spin up multiple sites, using the same code base, by creating a folder in the sites directory that matches the host name and path. Drupal’s multi-site capability has been around for quite some time.
