Multisite Drupal problems

I’ve noticed that the vast majority of problems people have getting multisite Drupal to work comes from not understanding this one concept:

<?php

/**
 * The configuration directory will be discovered by stripping the
 * website's hostname from left to right and pathname from right to
 * left. The first configuration file found will be used and any
 * others will be ignored. If no other configuration file is found
 * then the default configuration file at 'sites/default' will be used.
 *
 * For example, for a fictitious site installed at
 * http://www.drupal.org/mysite/test/, the 'settings.php'
 * is searched in the following directories:
 *
 *  1. sites/www.drupal.org.mysite.test
 *  2. sites/drupal.org.mysite.test
 *  3. sites/org.mysite.test
 *
 *  4. sites/www.drupal.org.mysite
 *  5. sites/drupal.org.mysite
 *  6. sites/org.mysite
 *
 *  7. sites/www.drupal.org
 *  8. sites/drupal.org
 *  9. sites/org
 *
 * 10. sites/default
 */

Drupal will guess what website you’re looking for based on those rules. It will find the closest config file based on those rules. Your config folder must be named just like one of these. You can’t name it “drupal” or “mysite”, or Drupal will never find it.

If you’re getting errors about database misconfigurations, if you have more than one domain showing the same Drupal site, or if you can’t seem to get it installed at all, check the name of your config folder…