How can I configure Drupal 8 with multi-site under an add-on domain using cPanel? I'm getting a 404 when I browse to my subdomain after following these steps:

  1. Clean install of Drupal to my add-on domain: /public_html/addondomain.com/drupal. I can successfully browse to addondomain.com/drupal
  2. In cPanel, create a sub-domain at sub.addondomain.com with a document root at /public_html/sub.addondomain.com
  3. Create the directory /public_html/addondomain.com/drupal/sites/sub.addondomain.com
  4. Create a sites.php within public_html/addondomain.com/drupal/sites that contains the following code: <?php $sites = array('sub.addondomain.com' => 'sub.addondomain.com',);>. File permissions are 644.
  5. Copy /public_html/addondomain.com/drupal/sites/default/default.services.yml to /public_html/addondomain.com/drupal/sites/sub.addondomain.com/services.yml
  6. Copy /public_html/addondomain.com/drupal/sites/default/default.settings.php to /public_html/addondomain.com/drupal/sites/sub.addondomain.com/settings.php
  7. Remove the directory /public_html/sub.addondomain.com
  8. Create a symbolic link in /public_html/: ln -s addondomain.com sub.addondomain.com

When I do all of the above, I get a 404 error when I browse to both sub.addondomain.com and sub.addondomain.com/drupal. Why am I not redirected to the Drupal installation page where I can enter in my database info, etc.? Is the error with my symlinks? My server (cPanel) configuration? My .htaccess under either my /public_html, public_html/addondomain.com, or /public_html/addondomain.com/drupal?

  • I deleted my answer because I didn't read your question thoroughly enough and it was wrong.
    – rooby
    Feb 9, 2018 at 9:16
  • Could the user who downvoted my question provide a justification? I'd like the chance to revise my question before getting dinged. Thanks! Feb 9, 2018 at 19:42
  • I'm not the down-voter but it could be that it is a bit hard to say what the problem is without having access to the server to troubleshoot. It could possibly be a problem with server config & symlinks, it could be a problem with ownership/permissions of the website files and/or webroot folder (in my experience cPanel generally doesn't like you to do things like step 7 & 8 manually if it messes with the directory ownership), or it could be something else entirely.
    – rooby
    Feb 10, 2018 at 0:05
  • Can you confirm that the 404 error is being returned by your main Drupal install at /public_html/addondomain.com/drupal? If so the watchdog log for that Drupal site should contain the 404 error. If so that should narrow it down to a Drupal multi-site configuration issue because it means that the server configuration is working correctly.
    – rooby
    Feb 10, 2018 at 0:11
  • Also, make sure that your settings file for the sub-site doens't still contain the configuration for your main Drupal site. Otherwise Drupal will think it's already installed.
    – rooby
    Feb 10, 2018 at 0:13

2 Answers 2


My solution was to point the document root of sub.addondomain.com to /public_html/addondomain.com/drupal. I did this within cPanel, which - if I understand cPanel correctly - is going to directly edit the Apache VirtualHosts directives within Apache's config files for my site (something I wouldn't have access to directly with shared hosting).


You say this,

  • Drupal is installed under addondomain.com in /public_html/addondomain.com/drupal
  • The document root for sub.addondomain.com is set to /public_html/sub.addondomain.com

If this is accurate, they're looking for files in different places. Make sure these two are setup the same (either with or without the drupal suffix).

Create a sites.php within public_html/addondomain.com/drupal/sites that contains the following code: 'sub.addondomain.com',);>. File permissions are 644.

Move or remove this file. It's not needed with your naming scheme and it's simply adding another step to debug.

 * For example, for a fictitious site installed at
 * https://www.drupal.org:8080/mysite/test/, the 'settings.php' file is searched
 * for in the following directories:
 * - sites/8080.www.drupal.org.mysite.test
 * - sites/www.drupal.org.mysite.test
 * - sites/drupal.org.mysite.test
 * - sites/org.mysite.test
 * - sites/8080.www.drupal.org.mysite
 * - sites/www.drupal.org.mysite
 * - sites/drupal.org.mysite
 * - sites/org.mysite
 * - sites/8080.www.drupal.org
 * - sites/www.drupal.org #THIS PATTERN WILL MATCH
 * - sites/drupal.org
 * - sites/org
 * - sites/default

More info here, https://github.com/drupal/drupal/blob/17ebfff72673728bc8495d67f35061ad8bdcc299/sites/default/default.settings.php#L13

> My .htaccess under either my /public_html, public_html/addondomain.com, or /public_html/addondomain.com/drupal?

Could you explain a bit more why you have .htaccess files under /public_html/addondomain.com and under /public_html/addondomain.com/drupal?

I think I get my last question (above crossed out, leaving for reference of others). You created a directory under addondomain.com for drupal, /drupal. Now you are trying to access it via a subdomain. If you want to access it without /drupal at the end you should update the symlink to ln -s addondomain.com/drupal sub.addondomain.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.