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:
- 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/.
- 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.
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.
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.
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.
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.