Extracting Sites from a Drupal Multisite
Learn how to separate the codebases to import individual Drupal sites to Pantheon.
Pantheon only supports one application codebase and one database per site. We do not recommend using database prefixes or offer support for Drupal Multisite implementations. If you are currently struggling with a Drupal Multisite and want to use Pantheon, you'll need to "unwind" the implementation, separating it into individual sites. You may also create a Custom Upstream if appropriate for your use-case.
Migrate One Site Out of a Multisite to Pantheon
This method will safely migrate a single site out of your Drupal Multisite and into Pantheon. You may experience some issues, such as warnings from Launch Check about Multisite, but they are generally false positives, and you can clean that up once the site is liberated and on its own.
Create a site archive for the site you want to migrate by running
drush ard sitename1
.Use the import wizard to import the site to Pantheon. Keep a local copy of the archive. You may need to restore
settings.php
, check againstsites.php
.Check the imported site on Pantheon to make sure it is working, even though there will likely be file assets missing. Take note of the paths for the broken assets, usually
sites/sitename1/files/image.png
.Configure the new site to use Drush 7 or greater.
Install Drush SAR 2.x as described in this blog post.
Backup the site in the Dashboard, just in case.
Run
terminus drush <site>.<env> -- sar --dry-run sites/sitename1 sites/default
to test the search and replace. This exact command can change depending on the name of your site, and broken assets in step 3.Once the dry run looks good, do it for real, e.g.
terminus drush <site>.<env> -- sar sites/sitename1 sites/default
.Check your site again for broken links and images. We recommend using a link checker.
You may need to edit
settings.php
to be a Pantheon-friendly version and then put it back in after the migration.
Maintain a Single Codebase for Multiple Sites
This method uses a Custom Upstream, a feature available to EDUs, Enterprises, and Pantheon Partner Agencies.
Create a Custom Upstream based on the multisite configuration.
Archive each of your sites using
drush ard
.Create a new site based on the upstream.
Then for each site:
Git clone the repo locally.
If there are customizations on the individual sites that are not incorporated into the upstream repository, commit those changes from your archives into the local repo.
Run
drush sar --dry-run sites/sitename1 sites/default
to test the search and replace. You can runterminus drush
or runterminus aliases
, and then run local Drush.Run
drush sar sites/sitename1 sites/default
.Check your site and fix broken links and images. We recommend using a link checker.
You may need to edit
settings.php
to be a Pantheon-friendly version and then put it back in after the migration.