DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk11 min

How to Move a Drupal Site’s Files and Database to a New Server

Move a Drupal site safely by rebuilding compatible infrastructure, transferring code and public/private files, importing the database, updating settings.php, testing on a temporary hostname, and cutting over DNS only after verification.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A complete Drupal migration copies the codebase, Composer dependencies, public and private files, configuration secrets, and database; then you test the new installation before changing DNS. The safest sequence is to inventory and freeze changes, make protected backups, rebuild a compatible stack, restore files and SQL, update settings.php, clear caches, test through a temporary hostname, and keep the old server available for rollback.

What a Drupal move actually includes

Moving only the web directory is not a migration. A working Drupal site is the combination of several components that must remain consistent:

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Application code: Drupal core, contributed and custom modules, themes, libraries, and any web-server configuration kept with the project.
  • Composer metadata and dependencies: composer.json, composer.lock, and the dependency tree generated from them.
  • Public files: usually the site-specific sites/default/files directory, although a multisite installation can use another directory.
  • Private files: the directory configured for private-file storage, which must remain outside unintended public access.
  • Configuration and secrets: settings.php, included settings files, database credentials, the hash salt, trusted-host patterns, and environment-specific overrides.
  • Database: content, users, configuration, field data, cache tables, queue data, and any application-specific tables.

Leaving out one of these can produce a site that appears to load but has missing images, failed logins, broken forms, absent configuration, or inaccessible private documents.

Choose a migration method before touching the source site

Your access level, Drupal generation, site size, and downtime tolerance determine the practical workflow. These are the supported patterns described in Drupal and Drush guidance:

#1 Best Overall
Drupal 6 Content Administration
  • Used Book in Good Condition
Situation Typical workflow Important consideration
Composer-managed Drupal with SSH Clone the repository, run composer install, transfer files with SSH or rsync, and dump/import SQL with Drush or native database clients. Rebuilding from the repository is safer than copying only the document root.
Archive-based transfer Use the archive command available in your installed Drush version to package code, files, and database, then restore with a compatible workflow. Archive command names changed: Drush 14 documents archive:dump; older documentation describes archive:restore, while the current Composer guide says archive restore was removed in Drush 13.
No shell access Use the Backup and Migrate module or your host’s database and file-management tools. Browser uploads are a poor fit for very large SQL dumps; host-native import tools are more reliable.
Drupal 7 or another legacy, non-Composer site Copy the code and files, import the SQL dump, edit settings.php, adjust the base URL where applicable, and change DNS after testing. Drupal 7 instructions describe the general sequence, but newer Drupal versions use different commands and security practices.

1. Inventory the source and schedule a freeze

Before creating a backup, record the versions and integrations that the destination must support. Document the Drupal and Drush versions, PHP version, database engine and version, web-server document root, public-files location, private-files location, Composer files, cron jobs, mail delivery, queues, payment or webhook integrations, and the DNS records that will change.

PHP and database compatibility are restoration requirements, not optional notes. Drupal’s documentation specifically advises documenting the PHP and database versions used by the site so compatibility can be checked during restoration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Plan for writes during the move

Any order, registration, comment, form submission, editorial change, or other write that occurs after the final database dump will not exist in that dump. Schedule a maintenance window, put the old site in maintenance or read-only mode for the final capture, or use another process that prevents writes. Lower the DNS TTL ahead of the cutover so resolvers can update sooner, while remembering that existing cached records can still delay traffic changes.

Capture a rollback point

Keep the source database untouched until the destination has passed functional tests. Preserve the exact SQL dump, code commit, Composer lock file, settings backup, and transfer checksums used for the cutover. Do not destroy the old environment when the first page on the new server loads; it is your fastest rollback option.

2. Back up every rebuildable component

Export the database

With Drush available, create a SQL dump using:

drush sql:dump > backup.sql

The equivalent native command depends on the database engine and its client utilities. Record the dump filename and checksum, and make sure the command completed without truncation or errors. A database export alone is not a full Drupal backup.

Save Composer-managed code

Commit or otherwise preserve the repository state that produced the running site, including composer.json and composer.lock. Also preserve custom modules, themes, libraries, patches, and deployment scripts. Files ignored by version control can still be essential: back up settings.php, included local settings files, certificates, private keys, and other secrets through a protected channel.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copy public and private files

Copy the complete site-specific public-files directory, normally sites/default/files, including image styles and generated assets that your deployment expects. Locate the configured private-files directory and copy it separately. Check for additional asset directories used by custom code or multisite settings.

Use checksums and an untouched copy

After creating the SQL dump and file archive, calculate checksums and compare them after transfer. Keep one untouched copy away from the old server. Drupal’s user guide warns: “For security reasons, avoid storing this file on your hosting server anywhere under the Drupal site root.” That warning applies especially to SQL dumps, which can contain passwords, email addresses, tokens, and unpublished content.

3. Protect backups before transferring them

  • Store SQL dumps and archives outside every web-accessible directory.
  • Restrict filesystem permissions so the web server and intended administrators are the only accounts that can read them.
  • Encrypt backups when they leave the server or when your threat model requires it.
  • Do not commit settings.php, database passwords, API tokens, or private keys to a public repository.
  • Retain the original dump unchanged; work on a copy if you need to inspect or transform it.

Do not place a downloadable archive in the Drupal document root as a temporary convenience. If a backup has been exposed, remove it, rotate credentials contained in it, and treat the old copy as compromised.

4. Provision a compatible destination

Create an empty database and a dedicated database user on the new server. Install a PHP and database stack compatible with the source, and enable the PHP extensions required by your Drupal version and modules. Match the web-server document root and ensure the destination can write to the configured files directories without making private files public.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rebuild Composer sites from source control

Clone or copy the repository at the exact commit you intend to run, then install dependencies from the lock file:

composer install

Do not assume that copying only the web directory reproduces a Composer-managed deployment. The lock file determines dependency versions, while the repository contains custom code that may not be present in a generated directory.

Prepare scheduled and background work

Recreate cron jobs, queue workers, mail delivery settings, and any container volume mounts or service accounts. A site can pass a page test while silently failing cron or queues because those jobs still point to the old path, hostname, credentials, or PHP binary.

5. Transfer code and files

Restore the codebase first, then copy public files, private files, and any additional directories required by custom code. Drush aliases can support drush rsync for remote file synchronization. For large trees, SSH-based synchronization is generally more dependable than uploading many files through a browser because it can preserve directory structure and resume or verify transfers.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Teacher Record Book
  • Keep track of everything from attendance to test scores
  • Spiral bound
  • Measures 8-1/2" x 11"

Check paths after the copy

  • Confirm that the document root points to the intended Drupal web directory.
  • Confirm that the public-files path in configuration matches the directory you copied.
  • Confirm that the private-files path exists and is outside unintended public access.
  • Preserve ownership and permissions expected by the web server and deployment user.
  • Check SELinux, AppArmor, container volume, or filesystem policies if PHP can see a directory but cannot write to it.

6. Update settings.php for the new environment

Edit the destination copy of settings.php; do not overwrite it with a file that still contains the old server’s credentials or paths. The $databases definition must use the destination database name, host, username, password, port, and driver. If the database is on a separate service, the host may not be localhost.

Also verify the following settings:

  • $settings['hash_salt']: retain the site’s intended secret rather than casually generating a different value during a move; changing it can invalidate security-sensitive values.
  • Trusted host patterns: include the temporary test hostname and final domain as appropriate, without allowing arbitrary host headers.
  • File paths: point public and private files to the restored directories on the destination.
  • Environment overrides: update reverse-proxy, HTTPS, cache, configuration-split, and service-specific settings that differ between servers.

Keep credentials in a protected settings include or secret-management system rather than a public repository. A typical database block contains the keys database, username, password, host, port, and driver; preserve the syntax used by your Drupal version and database driver.

Changing domains safely

If the move also changes the domain, review environment-specific URLs, redirect rules, webhook endpoints, and serialized data. Do not perform a blind SQL search-and-replace across every table: serialized values can be corrupted when string lengths change, and URLs may appear in configuration or content with different escaping. Use Drupal-aware procedures for URL updates and then test representative content, redirects, and integrations.

7. Import the database

Create the destination database as an empty database before importing. Confirm that the destination user has the privileges required by Drupal, then import through SSH or a native client.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Drush import

With the destination code and settings in place, either of these Drush forms can feed the dump to the database client:

drush sql:cli < backup.sql
drush sqlc < backup.sql

Use the command supported by the installed Drush version. If Drush cannot connect, test the database host, port, credentials, firewall rules, and PHP database extension before retrying.

Native client import

The native mysql or psql client is appropriate when the database server is reachable over SSH or through host-provided tooling. For a large dump, avoid a browser upload that can time out or exceed an upload limit; use an SSH session or the hosting provider’s server-side import facility instead.

Verify the import

Check that the import completed without errors and that the destination contains expected tables, users, content, and configuration. Compare representative database counts with the source. If the final source dump was taken before a write freeze, do not import an earlier copy after allowing new writes; repeat the final dump and import.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

8. Rebuild caches and correct permissions

After the database import and settings update, rebuild Drupal caches with the version-appropriate command:

drush cr

Then verify ownership and write permissions on public and private files directories. If cache rebuild fails, inspect the PHP error output and Drupal logs for an incorrect database connection, missing extension, unwritable files path, stale settings include, or an incompatible module.

9. Test the new site before changing DNS

Use a temporary hostname or a local hosts-file override so you can exercise the new server while public DNS still points to the old one. Test as both an anonymous visitor and an authenticated administrator.

Page and account checks

  • Open representative anonymous pages and confirm clean URLs, redirects, and HTTPS behavior.
  • Log in, visit administrative pages, edit content, upload a file, and submit forms.
  • Search for known content and compare results with the source.
  • Open original images and newly generated image styles.
  • Download private files through the intended access-control path and verify that guessing a public URL does not expose them.

Operational and integration checks

  • Run cron and confirm that queues advance instead of accumulating.
  • Send test mail and inspect delivery logs.
  • Exercise payment, webhook, API, and external-service integrations in their safe test mode where available.
  • Check redirects, canonical URLs, robots behavior, certificates, and mixed-content warnings.
  • Review PHP, web-server, database, and Drupal logs while performing the tests.

Compare representative content and database counts between old and new environments. A successful homepage response is not evidence that uploads, private files, cron, or integrations work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

10. Cut over DNS and monitor the result

  1. Put the old site in maintenance or read-only mode for the final capture, if possible.
  2. Take the final SQL dump and repeat any file synchronization needed for uploads created since the earlier backup.
  3. Import the final dump, rebuild caches, and run the highest-risk smoke tests again.
  4. Point the relevant DNS records to the new server.
  5. Watch access logs, error logs, queue activity, mail, and integration callbacks as traffic moves.
  6. Keep the old server, exact backups, and rollback notes until traffic and functional tests remain clean for a period appropriate to your site.

If new writes reached the old site during cutover, stop accepting additional writes, create another final dump, import it, and repeat the affected tests. Do not merge two databases by manually copying a few tables unless you have a Drupal-aware, application-specific plan.

Common failure modes and fixes

The site shows a database connection error

Recheck the destination database name, host, port, username, password, and driver in settings.php. Confirm that the database user can connect from the web server and that network rules permit the connection. Verify that the PHP extension for the selected database engine is installed.

Best Value
Drupal 5 Views Recipes
  • Used Book in Good Condition

Images are missing or uploads fail

Confirm that the complete public-files directory was copied, that the configured path matches its destination, and that the web-server account can read and write where Drupal requires it. Rebuild caches and image styles after correcting ownership or paths.

Private files are exposed or inaccessible

Check the private-files setting, web-server deny rules, and filesystem permissions. Private files should not be reachable through an unintended static URL. Test both an authorized download and an unauthorized request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Trusted-host or redirect errors appear

Add the temporary test hostname and final hostname to the intended trusted-host patterns, then review reverse-proxy and HTTPS settings. Remove temporary hostnames before declaring the migration complete if they are not part of the production environment.

Drush archive commands do not work

Run the command documented for the installed Drush release. Drush 14 documents archive:dump; archive-restore instructions from older releases do not automatically apply to Drush 13 and later Composer workflows. Fall back to separate code, file, and SQL backups when archive support is unavailable.

The destination works but cron, queues, or mail do not

Recreate scheduled jobs with the destination paths and PHP binary, confirm queue workers can reach the database, and update mail credentials or relay restrictions. Inspect logs while triggering each job manually.

When shell access is unavailable

The Backup and Migrate module provides an administrator-oriented alternative for backing up and restoring databases and files, with Drush integration where available. It can simplify a control-panel-only move, but the same safeguards still apply: protect the backup, verify PHP and database compatibility, restore private files, test through a temporary hostname, and retain a rollback copy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a large site, ask the host for server-side SQL import and file-transfer options rather than uploading a multi-gigabyte dump through a browser. If you cannot safely edit DNS, database permissions, or web-server access rules, a managed Drupal migration service or an experienced administrator can reduce the risk of an extended outage.

Quick Recap

Bestseller No. 1
Drupal 6 Content Administration
Drupal 6 Content Administration
Used Book in Good Condition
$45.99
SaleBestseller No. 2
Bestseller No. 3
Teacher Record Book
Teacher Record Book
Keep track of everything from attendance to test scores; Spiral bound; Measures 8-1/2" x 11"
$4.89
Bestseller No. 4
Bestseller No. 5
Drupal 5 Views Recipes
Drupal 5 Views Recipes
Used Book in Good Condition
$57.99

Final migration checklist

  • Drupal, Drush, PHP, database, Composer, paths, cron, mail, and DNS details recorded.
  • Source writes frozen for the final dump.
  • SQL dump, repository state, lock file, public files, private files, settings, and secrets backed up.
  • Backups protected outside the web root, with an off-server copy and checksums.
  • Compatible destination stack, database, user, document root, extensions, and writable directories prepared.
  • Code rebuilt from the repository and dependencies installed.
  • settings.php updated for database, hash salt, trusted hosts, files, and environment settings.
  • Database imported and verified; caches rebuilt with drush cr.
  • Anonymous, authenticated, administrative, upload, private-file, cron, queue, mail, integration, HTTPS, and log tests passed.
  • DNS changed only after testing, with the old server and verified backups retained for rollback.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.