---
title: "Preparing to migrate sites into Site Factory"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to prepare your websites for migration to Site Factory. Understand file structures, create Drush aliases, and follow our checklist for a smooth transition to Acquia's multisite platform."
image:
type: "page"
url: "/site-factory/preparing-migrate-sites-site-factory"
id: "d7fb26ae-b7d4-49b4-ab02-fa63a70e2c7b"
---

**ADVANCED**: Incorrectly migrating a website without properly preparing for the attempt can involve data loss or a website outage event.

Attempting to import an existing Drupal website into Site Factory both requires that you understand how Site Factory structures the websites that it hosts, and that you complete the required preparatory work to ensure a smooth, repeatable migration process, which can provide you a local backup of your work should a rollback of your migration be needed.

The information on this page is intended as preparation for actually [migrating your website into Site Factory](/site-factory/migrate/execute).

Checklist for website migration
-------------------------------

Acquia has identified a common list of tasks to consider as part of your initial sprint (Sprint 0) planning for an Site Factory migration. Although the activities described on [Checklist for migrating your sites to Site Factory](/site-factory/migrate/plan) are not a complete list, they can help you to identify the work that is necessary for a successful launch, and also identify the tools that can assist you.

File structure in Site Factory
------------------------------

When you are preparing to migrate a website, it helps to understand how files are organized in a Site Factory installation. Migrating a website into Site Factory involves all three major sections of a Drupal website:

*   [Shared codebase across all websites](#acsf-files-shared-all)
*   [Website-specific files directory](#acsf-files-site-specific)
*   [Per-website theme directory](#acsf-per-website-themes)

### Shared codebase across all websites

The code in your Factory’s main version control repository contains your Drupal core and contributed module files that are to be used for all websites in your Factory. You must use version control processes to modify this code. Storage and retrieval times are faster here than in the distributed file storage system used in your [website-specific files directory](#acsf-file-structure), so Acquia recommends that you store website-specific modules in one of the following directories, based on your distribution:

*   _Using a distribution_: `profiles/[profilename]/modules`
*   _Not using a distribution_: [Current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version): The top-level `modules` directory; Drupal 7: `sites/all/modules/`

Acquia discourages the use of the `sites/default` directory, with the exception of `sites/default/files`, as files in `sites/default` will not be included in website backups.

Note

For instructions regarding allowing your codebase access to sensitive credentials, passwords, or other private information, see [Storing sensitive information outside of your codebase](/secrets).

### Website-specific files directory

Your website’s `files` directory should contain the binary file assets (images and videos) your website needs that cannot be easily stored in version control. This `files` directory, and its contents, reside on a writable, distributed file system shared by all of your Site Factory-hosted websites. Since this file system is external to your shared codebase, access times for files stored in your `files` directory will be slower than access times for [files stored in the shared codebase](#acsf-files-shared-all).

The `files` directory for your website is located at `sites/g/files/[abcde]`, where `[abcde]` is a random string.

Public files reside in the `sites/g/files/[abcde]/files/` directory.

### Per-website theme directory

Your website-specific directories each contain a `themes` directory. Acquia strongly encourages that you store your per-website themes in this location, as storage and retrieval are far faster than the distributed storage system used in your website-specific files directory. For information about creating a theme repository for each of your websites in Site Factory, see [Adding external themes to your site](/site-factory/theme/external).

If you configure a dedicated theme repository for a website, `sites/g/files/[abcde]/themes/site` will be a symlink to local storage for that repository.

### Configuration management directory

The [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version) requires writable directories for importing configuration values, such as user roles and permissions. The default location for the `vcs` and `sync` directories (`config/default`) is not writable on Site Factory, and must be configured by a [post-settings-php hook](/site-factory/extend/hooks/settings-php) as described in [Importing a configuration directory](/site-factory/extend/hooks/settings-php#acsf-post-settingsphp-import-config).

Preparing Drush aliases for the import process
----------------------------------------------

The import process uses [Drush](https://www.drupal.org/project/drush) commands, so creating Drush aliases for your target website allows you to execute Drush commands without needing to sign in to your target website to copy files using SSH.

To configure your aliases to run the correct version of Drush, create a Drush aliases file based on the following example, altering the code to meet your needs:

    $aliases['cloud-platform'] = array(
     'path-aliases' => array(
      // uncomment this line if deploying a D8 codebase
      // '%drush-script' => 'drush8',
      // uncomment this line if deploying a D7 codebase.
      // '%drush-script' => 'drush6',
       '%dump-dir' => '/mnt/tmp/',
     ),
    );
    $aliases['target'] = array(
     'parent' => '@cloud-platform',
     'uri' => 'mynewdomain.customername.acsitefactory.com',
     'root' => '/var/www/html/AH_SITE_GROUP.AH_SITE_ENVIRONMENT/docroot/',
     'remote-host' => 'managed-12345.defaultrealm.hosting.acquia.com',
     'remote-user' => 'YOURUSERNAMEHERE',
     'path-aliases' => array(
       # the following is optional if you want to have a dedicated temp dir
       # without many other files in there:
       '%dump-dir' => '/mnt/tmp/AH_SITE_GROUP.AH_SITE_ENVIRONMENT/drush-import/',
     ),
    );

If you need assistance determining what these values should be, [contact Acquia Support](../support.html#contact-acquia-support).

Note

The instructions in the website migration process that reference the `@target` alias assume you have created and implemented this file, and will execute `@target` commands from your local computer to affect your intended target website.

To verify that your Drush aliases are functioning properly, from a command line window, run the following command:

    drush @target status

Examine both the **Site path** to determine if it matches the path `sites/g/files/[abcde]` (where `[abcde]` is a random string), and the **File directory path** to determine if it matches `sites/g/files/[abcde]/f` (where `[abcde]` is a random string).

If both the **Site path** and the **File directory path** values match the described strings, your Drush aliases are connecting to your server.

Common sources of problems with this file include the following:

*   Incorrect values for `uri`, `remote_host`, or `remote-user`
*   Not committing the `sites/g/` directory to the codebase after executing `drush acsf-init`

Next steps
----------

After you ensure that your website will work with the Site Factory directory structure and you test your Drush aliases, you should review [Checklist for migrating your sites to Site Factory](/site-factory/migrate/plan).