Development environment prepared for later migration to live site

Submitted by Jürgen Haas on Wed, 10/07/2009 - 16:14

Although so many articles have been written about this issue already, the approach I'm using successfully hasn't been mentioned yet - or I missed the appropriate post. Hence I'm writing another one and hope people may find this useful.

What's the issue?

When developing a website for on a server with a URL/domain which most likely is different from the URL/domain of the live site later on, you will run into trouble when migrating from development to live because of some files and links in nodes and elsewhere being addressed in a location which by default contains the domain name in the path and therefore will be broken after .

How to setup environment to avoid this issue early?

First of all, follow the standard instructions for setting up your new site on the server. In particular, create the directory DRUPAL_ROOT/sites/dev.example.com and inside this directory the file settings.php. All the settings inside this file should be standard, so no difference to any other site you would be setting up for .

In this example we are developing on http://dev.example.com and to install your site you should next call http://dev.example.com/install.php and follow the instructions.

When done your site is ready. Now, hold on! Before you do anything else you should now change one of the default settings to be ready for later :

Let's assume the site will move to http://www.mycustomer.com later on, please follow these steps:

  1. Create the directory DRUPAL_ROOT/sites/www.mycustomer.com/files on your server
  2. Go to http://dev.example.com/admin/settings/file-system and change the setting in the first field file system path from sites/dev.example.com/files to sites/www.mycustomer.com/files and save the configuration

Now you're done. You can develop without any problem and once you migrate to the live site, you don't need to change any values or even database content. It's just done.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.