Hi,

I'm constructing a Drupal powered website for a charity. I'm building the website on a spare domain I own. When the site is complete, we'll need to migrate the drupal site to the charity's existing domain name.

Will this be difficult?
What steps will I need to consider to make the transition?
Is there anything I could take into account at this early stage to make things easier when we decide to make the switch?

Your help would be most appreciated.

Michael

Comments

conorcan’s picture

There are a few things you should keep in mind.

The first is to always be prepared for the worst! So, make a copy of your existing website (everything; files, database information, database structure, etc.) just before you make the transfer.

Try and schedule the transfer during a period where there is relatively low traffic to your site.

I recommend putting the new website into a test folder on the same server as the existing website, to see if it works with the server configuration.

Actually, there are quite a few steps so if you Google 'moving website to different server' you can find out more information.

With Drupal, you might have to edit the settings.php file to reflect the new server settings. Also, you might have to change the site information in the admin section.

If you contact me I might be able to help you out personally, considering it's for a charity website.

conorcan’s picture

By the way, it sounds like you're changing your servers, not just your domain name. Right?

michaeljw’s picture

Hi conorcan,

Thanks for your help, and thanks so very much for offering a line of contact - very kind.

We will hopefully be changing the server. I'm going to ask the client if they will migrate to our dedicated server.

My query really relates specifically to the actions needed related to Drupal itself, i.e. what references are there to the domain name within the Drupal files and the database? So far we have:

1) Edit the settings.php file to reflect the new server settings.
2) Change the site information in the admin section.

If anyone knows of any other steps, It'd be great if you could add them to the list.

Many thanks,
Michael

michaeljw’s picture

I've been investigating a little further. Here's another consideration...

When the domain name of the website is changed, all of the internal links within the site nodes will be broken, since they point to some absolute URL - http://old-domain.com/node/2 etc. The links in the menus might be ok, since presumably when the domain name is changed in administer > site information, they will change too? However I'm certainly not sure about this.

How can I get around this problem? Is there any way of setting up the internal links in Drupal so that they are independent of the domain name? (In a standard HTML page you could do something like link text - this is obviously independent of the domain name).

Thanks,
Michael

michaeljw’s picture

Aha, simple. Here's the answer:

Make your internal links relative to the root directory e.g. instead of using href="http://mydomain.com/about/FAQ", use href="/about/FAQ" or href="about/FAQ".

So, our list of points to consider when changing a domain name of a Drupal site are now

1) Edit the settings.php file to reflect the new server settings.
2) Change the site information in the admin section.
3) When you build a site, make all internal links relative to the root directory (i.e. independent of domain name).

Any more? It would be a great resource for everyone if we could make this a conclusive list.

Michael

flaviovs’s picture

Be specially careful if your development Drupal is being used in a multi-site installation.

In D6, all internal generated links to your uploaded files will point to your "files" directory which in turn will link using the directory with your dev domain in the path.

For example, if your multi-site development Drupal is serving dev.example.com, then you may have many links pointing to "/sites/dev.example.com/files".

Things get worse if you put your theme inside your configuration directory. You may then have to make sure that all links in your theme files points to the correct directory. This affect all version of Drupal.

Fortunately, the solution for the DB problem is simple: when you dump your DB to deploy it on your production server, just to a search-and-replace in your SQL file looking for your old domain name and replacing it with your new domain.

Assuming your development server is at dev.example.com and your production server is at www.example.com, then if you use Unix, you can do it with the following command:

$ sed 's/dev\.example\.com/www.example.com/gi' dev-dump.sql > prod-dump.sql

Of course, you can use your favourite text editor to do the search-and-replace. Just make sure that:

  • Your editor can handle the entire SQL file, as it's usually bigger that most basic editors (e.g. Notepad) can handle; and
  • Your editor can read and write UTF-8 encoded files properly.

In Windows, you can use Notepad Plus for this task.

Also, don't forget to clear your cache on your production server right after you import your dev DB.

Good luck!

conorcan’s picture

1) Edit the settings.php file to reflect the new server settings.
2) Change the site information in the admin section.
3) When you build a site, make all internal links relative to the root directory (i.e. independent of domain name).

Maybe not Drupal specific, but make sure the two servers are running the same version of PHP. Some contributed modules throw errors with different versions of PHP. PHP5.3 for example, throws some errors with certain modules that previous versions of PHP5.X didn't.

Same principle applies for MySQL 4.X versus MySQL 5.X

The Apache configuration can also have an effect. For example, you might need to increase your memory limit, or enable clean URL's or enable mod rewrite etc.

If you use image manipulation, make sure you have GD or imagemagick installed.

1websitedesigner’s picture

If you're changing the domain name it's also worth checking the .htaccess file in the root folder. If you've specified that e.g. http://example.com forwards to http://www.example.com, then the domain name also crops up there.

wmad’s picture

I changed the url, updated settings.php and was getting "access denied" when I login as admin.

The solution: Make sure you change the permissions of settings.php before uploading the updated file via FTP! Also, you should run update.php after setting $update_free_access = TRUE in settings.php

queryblitz’s picture

And then search through the output for any occurances of the old domain. Just did that on my website, should have a long time ago as the main Register link was bad. Oops!

Here's an outbound link checker:

SEO Tools - Site Link Analyzer