tags:

views:

96

answers:

4

I want to move a drupal site to another domain and am looking for best practices, gotchas, hint, tips, etc to make sure I get through it smoothly.

Links and comments are appreciated.

+2  A: 

It took me 1-2 hours. I do not have a step-by-step guide (I wish I had written everything down), but it entails updating the configuration files, updating the database (some tables have domain references, but I don't recall which - it could be that this was just for my image references in the Gallery2 database), and doing a cursory search of the content for full domain references in anchor links.

I migrated a Drupal 6 site with about 40 plug-ins, including Gallery2 and Google Maps integration, and I did not run into any major road blocks.

cdonner
+2  A: 

You might want to give a try to the Backup And Migrate module.

There is also this handbook page that gives instructions on how to backup your drupal site.

Gregory Pakosz
+2  A: 

If you (and the authors of the contrib modules you used) did a good job by not putting absolute URL's in the code, it should be dead easy (I do it routinely when migrating the development site to a live production one, for its launch).

Of course I assume that you are doing things sensibly, and for example are not migrating a site from an apache/mySQL server to a nginx/postgres one, maybe also adding the need to prefix your DB tables in the process.

If this is the case, then you simply have to copy your entire file tree and export/reimport your DB.

If you are migrating between two similar architectures then chances are you will only have to change a few things in the settings.php file. The file is well documented. The only two things that I normally have to change are:

  • DB user/pass
  • cookies domain

In the file there are also additional configuration options like the possibility to choose the base URL manually in case of problems.

Don't forget to flush the cache once you log in the new migrated site for the first time.

EDIT: Just came to my mind: if you use any, you will also have to update your developer keys to third party API's (for example if you use google maps or google analytics) as these are domain specific.

HTH!

mac
Thanks! Yes, apache to apache and no, I don't think one can assume that I did anything sensibly being a total newbie to drupal, but i will manage thanks to all the help here.
Tim
If you are unsure about the quality of the code that has been written (of if there was a particular need to store absolute paths in the code) you could do one or both of the following: 1) **Deactivate (not disinstall) all the modules you have doubts about prior to moving the site, and then reactivate them one by one** on the new site, checking that nothing breaks along the way 2) **Scan the code of said modules for text matching `/\S+:\/\/\S+/` regex.** That matches all strings without whitespaces containing "://", like "http://whatever" or "ftp://whatever/else.omg). HTH! :)
mac
What above is complementary (thus not alternative) to what Henrik (+1) mentioned in his answer.
mac
+2  A: 

Basically, what mac said (+1)

In addition, I often need to adjust the .htaccess files a bit concerning the rewrite rules. For smaller sites on shared hosting environments, I usually place the drupal installations in subfolders within the document root (e.g. to allow for staging, etc.), 'hiding' the subfolder via URL rewriting. So for every 'move' of a site, I need to fix those rules.

The biggest culprit for me are sites that use modules that have to store absolute URLs in order to do their job (e.g. securepages). For those you should disable them prior to moving the site, adjusting their settings before reenabling.

If you are not sure if some of the modules you use store absolute URLs, it might pay of to extract your database dump locally and search the resulting file for occurrences of 'http://', 'https://' and the likes, as well as for your 'old' domain name (you'll need to exclude the watchdog and cache tables for this).

Henrik Opel
Yeah, thing that has caught me a couple of times is the sites folder changing, ie from sites/example.com/ to sites/example2.co so some things like the files table and references in the system table needed to be updated, but were missed when searching for 'http://' etc
Andrew

related questions