| Drupal

Moving a Drupal site to a new location on your server is surprisingly easy.

There is a simple 3 step process to move a Drupal site from one folder to another. In this tutorial we're going to show you those 3 steps.

If you'd like to move a Drupal site to new folder, we recommend using the Backup and Migrate module.

Step #1: Move the files

The first step in the process is to move your site files to their new location.

Browse to your Drupal site on your server and you see will see a files and directories like these below.

There are two different approaches you can take:

  1. Rename your older with the site inside. In this example, I'm going to take the current folder which is /old/ and rename it to /new/.
  2. Select the files and folders. Drag-and-drop them to their new location This would work best if you wanted to move your Drupal site from a sub-folder to your main directory.
media_1367945960909.png

Step #2: Edit settings.php

Now that your site is in it's new location, you'll be able to see your site. It may look perfectly OK, but the links to inside pages are unlikely to work. Click on any links and you'll get "Not Found" errors.

media_1367946240834.png

To fix the links on your site you need to edit your settings.php file.

The settings.php file is the most important file on your Drupal site. Click here for complete overview of settings.php.

To find the settings.php file, look inside the /sites/default/ folder.

media_1367946386420.png

Open the settings.php file.

You are looking for the lines around 229 to 249 that deal with your site's Base URL. You need to change the last line in this section to reflect your site's new location. In this example, I'm going to change /old/ to /new/.

Save the file.

media_1367946521896.png

Step #3. Test your site

Hopefully your site has been successfully moved.

Test all your links to make sure nothing is still broken. Also, browse the site to make sure you didn't miss any files and folders during Step 1.


About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.