Drupal 7: Move entire site to another host

STEP 1 of 2: EXPORT site

Assume you have a website at the excellent Pantheon (pantheon.io) and want to move it to Hostinger. (To move a site in the other direction, i.e. from Hostinger to Pantheon, have a look at this article instead). Assume also that your database name is MYDB, and your site is called MYSITE

1. Put the site into maintenence mode to stop traffic (database updates) to your site whilst moving:

Go to  Home » Administration » Configuration » Development

and select the checkbox: Put site into maintenance mode

2. Export the database

From Pantheon's dashboard, choose Workflow, Export, Export Database

3. Dowload the database to somewhere appropriate. Let's say it's called MYDB.tar.gz

Now lets save the file structure. Choose one of the following depending on taste:

4A. Use Git instead of SFTP:

a. From Pantheon's dashboard, choose Code, Connection Mode Git
b. Click the information icon for instructions if necessary
c. Copy the text (starts something like this: ssh://codeserver.dev...bla-bla-bla-whole bunch of stuff...)
d. In a terminal, position yourself appropriately add clone the site to your computer:

git clone ssh://codeserver.dev...bla-bla-bla-whole bunch of stuff...


4B. Use SFTP instead of Git

a. Connect to pantheon with e.g. Filezilla (which is officially gettable here)
b. Copy Pantheon's index.php and these folders (under the code/ folder) to an appropriate place on your computer:

drwxrwxr-x  4 mik mik  4096 feb.  25 19:10 includes
-rw-rw-r--  1 mik mik   529 feb.  25 19:10 index.php
drwxrwxr-x  5 mik mik  4096 feb.  25 19:10 misc
drwxrwxr-x 43 mik mik  4096 feb.  25 19:10 modules
drwxrwxr-x  6 mik mik  4096 feb.  25 19:10 profiles
drwxrwxr-x  2 mik mik  4096 feb.  25 19:10 scripts
drwxrwxr-x  4 mik mik  4096 feb.  25 19:10 sites
drwxrwxr-x  7 mik mik  4096 feb.  25 19:10 themes

5. Exit maintenece mode in your Pantheon site.

STEP 2 of 2: IMPORT site to Hostinger

1. From your cpanel dashboard, navigate to Databases, Import Database. Upload the MYDB.tar.gz database file you exported in step 1 and continue.

2. Fixup settings.php

On your local copy of the files your downloaded from the source site, edit sites/default/settings.php to reflect the database name and user on the target site. Search for $databases until you find a few lines of uncommented code that looks a bit like this:

$databases = array('default' => array( 'default' => array(
 'driver' => 'mysql',
 'database' => 'u333333333_abcde',
 'username' => 'u333333333_edcba',
 'password' => 'my_secret',
 'host' => 'mysql',
 'prefix' => 'spon_',
 'collation' => 'utf8_general_ci',

Change 'database', 'username' and 'password' to whatever you need. For 'prefix', remove the characters between the quotes leaving just the quotes so the line looks like this:

  'prefix' => ''

3. Fire up your FTP program and connect to the target site. In our example this is Hostinger. Position yourself at the remote host's public_html directory, and locally in the folder you saved the source site's web structure in step 1.4x above and upload everything

Updated 2015-08-19.