Moving drupal site to a different server

With no clear indication on how difficult this could be, I went ahead and started moving a drupal site to a different server (on a different domain). I first followed the standard procedure that I do in Joomla. That is, getting all the files to my local, exporting the databases from phpmyadmin to my local and uploading the files to new server and importing the database to the new server and finally, changing the configuration settings (settings.php in drupal). Turns out that, thats how actually it is done in drupal too but depending on the intial site setup it could be really troublesome for few to figure out the right settings and permissions.
After working on a simple move for more than an hour, I finally realized that the old drupal site was using clean urls and inorder for it to work on new server I must change the .htaccess file to map to new domain. Well that makes sense. So for someone who plans to do that now or in future, here are the quick steps:

If you get stuck anywhere dont hessitate to comment.

  1. Use any ftp client to download all the files (usuall all the files and folders under public_html folder) to your local.
  2. Use phpmyadmin (or any compatible client for database) to select and export out all the tables (just tables, dont export out the database).
  3. On your new server, create a new database and user (and of course map it to the database). Make note of database connection settings.
  4. Again use phpmyadmin (or equivalent client for db) to import the downloaded tables to this newly created database.
  5. Use ftp upload all the downloaded files and folders to the new server (keep the directory hirarchy as is).
  6. Edit /public_html/sites/default/settings.php file to include new database connection strings
  7. Optional (if you used clean urls on old site): Edit .htaccess file in /public_html/ folder to include new domain name.

Thats it. couple of steps and the site is totally on the new server and domain. This is a good practice for people who first load the site on test server then want to move to deployment server after completion. But anyways, if you need any assistance, do let me know.

Leave a Reply

Your email address will not be published.