Wednesday 18 September 2013

Moving a Drupal Site to a New Domain

Though it’s tempting to move your files and databases quickly, I suggest doing some preparation first. Before you move your Drupal site, you first check for any new Drupal core and module updates. If there are modules that need to be revised, you need to do the update before moving your site. The benefit of this is that it is easier to debug any problems that arise during the migration if you are ready employing the current version of all Drupal code.
Drupal needs installation and for this reason it is not possible to just move files between servers and expect your site to work, However, moving your Drupal site another domain or server can simply be done in few easy steps.
Here are the detailed steps how to effectively move a complete Drupal installation from one host to another.

Migrating Drupal On your OLD host:

1.    Backup your whole home directory from your ftp access using an ftp client like filezilla. Make a folder on your local hard disk and download the complete directory to that local folder.

2.    Backup your MySQL database on your old host using phpadmin, select your MySQL database, generally something like "name_drpl1". Select all fields, click "export" and save the database to your local hard disk. Leave default options enabled. You will receive a file similar to "name_drpl1.sql". This is your MySQL database.
On your NEW host:
1.    Upload your folder with the complete Drupal installation to your home-directory.

2.    Once done, go to cPanel -> MySQL on the new host, create a new MySQL database, example "name_drpl1" and create a new MySQL user. Create a password for this new MySQL user, click "assign all privileges" to this user and assign the user to the new database.

3.    You now should have a new MySQL database on the new host with a MySQL user, eg. "name_drpl1" as database name and "name_username" as database user name.

4.    Import (upload) the database (which you exported from the old host earlier) with phpMyAdmin to the new database. This might take several minutes.
5.    If needed edit the file [drupal home]/sites/default/settings.php and edit at the section where you enter the database, location, username and password. You CAN enter the password either encrypted or not encrypted there.

6.    Chmod your “files” folder so it is writeable using your ftp client (filezilla), chmod to 755

7.    Double check your .htaccess and [drupal home] /sites/default/settings.php and make changes in case they are needed.

Let’s see an example. Suppose your site is presently working at www.template-test.com/drupal and it needs to be moved to another domain at www.templatetesting.com/drupal. Here are the steps to follow:

1.    Log into the phpMyAdmin through the hosting Control Panel of your first site www.template-test.com/drupal and export the database. Save it as a .zip/.sql file on your computer.

2.    Move all your site files to a separate folder on your computer. In this example we are going to backup the content of the /drupal/ directory on our FTP. If your hosting Control Panel has a FileManager with the ability to archive the content, first archive it, then download and save it as a .zip file to your computer.

3.    You should now have one folder with the backup copy of your Drupal site files and another .sql or .zip file of the database.

4.    Log into the phpMyAdmin through the hosting Control Panel of your other site www.templatetesting.com/drupal and create a new database.

5.    Copy the name, the username and the password of the new database out for future reference.

6.    Open the new database you have just created through phpMyAdmin and import the database dump file exported from the old site into your new database.

7.    Upload the backup Drupal files to the directory or sub-directory on your new domain i.e. in the case with www.templatetesting.com/drupal  its  a /drupal/ subfolder.

8.    Go to the \sites\default directory on your new domain and open the settings.php file to edit (you can just download the file on your computer and open in any simple text editor like Notepad and upload it back once the changes are saved)
9.    You need to change the old info in lines 208 – 214 of that file with the corresponding info for the new database (step 5 of this tutorial):
'database' => ‘your_database_name’,
'username' => ‘your_user_name’,
'password' => ‘your_database_password’,
'host' => ‘your_host_name’,

10.    Save the changes to the file (or upload it back if you were editing it on your computer) and open the url of the new Drupal site, i.e. www.templatetesting.com/drupal. If you have done everything properly, you should see the site looking the same as on your old domain.

More:
Fortune Innovation Brisbane
http://brisbane.fortuneinnovations.com/
Web Development Company Brisbane