HostGator.com » Support Portal

How to move a Drupal site from one host to another

Drupal Hosting and Installation

Here are the detailed steps how to successfully move a complete Drupal installation from one host to another. You can also watch our video on how to install Drupal if you want to create a new Drupal installation.

The documentation on drupal.org is not necessarily clear, here are the exact steps how to move a complete site including your drupal mysql database.

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 harddisk and download the complete directory to that local folder.

  2. Backup your mysql database on your old host using phpadmin, select your mysql database, usually something like "name_drpl1". Select all fields, click "export" and save the database to your local harddisk. 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.
    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.

  3. Import (upload) the database (which you exported from the old host earlier) with phpMyAdmin to the new database. This might take a minute.

  4. 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.

  5. Chmod your "files" folder so it is writeable using your ftp client (filezilla), chmod to 755

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

Article Comments

Stephen
You may also need to change the url rewrite method if your old host uses a different 'clean url' method. The new host may display the main page, but any other page (login for example) may display a 404-Not found.

Go to http://example.com/index.php?q=admin/settings/clean-urls and disable clean urls to gain access to your new site; then you can enable clean urls in a manner that your new host supports. :)

Romka
How to move a drupal installation onto http://gator123.hostgator.com/~abc temporarily to test? The domain name transfer will happen after.

HostGator
Just move the site the exact same way you would move it if the domain was ready. Then use the temporary URL to view the results.

Drupal may have your domain name coded into the config file, or saved in the database. Often, this will cause popular scripts to only partially load. Some programs do require a working domain name to be viewed properly.

Vlko
Does HostGator support clean urls feature for Drupal?

HostGator
Yes, the Clean URLs feature uses mod_rewrite, so it will work fine.

http://drupal.org/getting-started/clean-urls

Liz
can hostgator transfer a drupal site for me? if so how much does that cost?

HostGator
Yes, we can transfer any sites which are compatible with our plans. Simply submit the appropriate transfer form at http://support.hostgator.com/addons.php and we will write you back with a quote if needed.

dashaver
I have found phpmyadmin unreliable for Drupal sites because of size limitations, fortunately the Backup and Migrate module works great and is much easier and more dependable. I would use it even for smaller sites

Erich Riesenberg
Prior to transferring files to Hostgator, should I delete all the files currently in the directory?

Thank you.

HostGator
It really shouldn't be necessary; any folders and files which already exists with the same names will be overwritten.

However, if you are very sure there are no files on the HostGator account which you need, it is better to delete anything you added or uploaded (especially if it is .htaccess, php.ini, or a configuration file).

John
I got clean urls working, but it adds a ~ before my username, so my site now looks like domain.com/~username. This is ugly. Is there any way to get rid of the ~username or at least the ~ part?

HostGator
The website URL is saved in the Drupal configuration file. Simply edit that file to fix the problem.

HOW?
Go to the root folder for your Drupal installation and navigate to the /sites/default/settings.php file. Edit this file and look for the "$base_url =" part. Update the value so it shows the domain name without the "~user" part.

EXAMPLE
Before:
$base_url = 'http://domain.com/~username';
After:
$base_url = 'http://domain.com/';

WARNING
If the file permissions for settings.php are 444, you must change them to 644 before you can save your coding changes.

HostGator
Thank you for your comments. Just a quick reminder that the comments on this page are not monitored by technical support staff, and that for support issues, it is best to contact us by live chat, phone or email so we can assist you right away.

Although comments are not monitored by technical support staff, they are moderated and read by technical writers. Comments will need to be approved by a moderator before appearing.

Our technical writers do read the comments periodically for the purposes of updating the articles, and do appreciate your feedback, suggestions and corrections to the articles themselves, as well as any suggestions or tips for readers of this article. However, support questions posted here are not guaranteed to be replied to in a timely manner or at all. For support issues, it is best to contact our support staff instead by live chat, email or phone.



Your comments help us keep the knowledge base updated. This is not a medium for support. If you have questions or need help, please contact us via email, phone or live chat for fast assistance.

Post Comment