Warning message

Documentation is currently being migrated into the new system. Some pages might be temporarily missing, and some guides might appear empty. Thank you for your patience while we are improving Drupal.org documentation.

Copying your test site to your live site (command line)

Last updated on
August 18, 2016 - 20:23

TIP: Make sure your test site is a recent copy of your live site, otherwise you will lose changes. It might be a good idea to create a new test site if it has been a while.

I. Backup Your Drupal Files
Copy the contents of your live site directory to a 'backup' directory, in case something goes wrong.

cp live_site/.htaccess backup/.

Make sure the .htaccess file gets copied to the 'backup' directory as well.

Once you have copied your test site to your live site and are using your test database as your live database, make sure that you create a new test copy of your live database when you create a new test site!

Do not use your live database with your test site or you risk corrupting and losing your live data!

II. Copy your test site files to your live site directory

  1. Delete all your live site files with the Unix 'rm' command. You made a backup, right?
  2. Copy the contents of your test site directory to your live site directory

    cp test_site/.htaccess live_site/.

Make sure the .htaccess file gets copied to the test_site directory as well.

III. Change settings.php in your live site Drupal files
Open and edit the file located under live_site/sites/default/settings.php with a plain text editor such as jEdit. Follow the directions in the file and modify this setting:

$base_url = 'http://www.example.com/';

(This is the address of your live site directory. This tells Drupal where to look for the Drupal files to connect with.)

There is no need to change the database settings. Just take note that your test site database is now being used as the live site database.

IV. Check if your live site works
Navigate to http://www.example.com/ and you should see your newly upgraded live site.