How to migrate a WordPress site to a new host and keep the same URLs

Short answer

Restore a copy of WordPress on the destination and test it under the real hostname before switching traffic. Keep one database in charge of orders, forms and edits throughout the move. Point DNS or the CDN at the new origin only after the final sync, certificate check and a successful application test. Keep the old host available until its logs show that traffic has drained and you have reconciled any delayed writes.

Read the guide

Updated:

Share

Summarize with ChatGPT or Perplexity

Two servers connected by a cable, with a removable drive bay

Decide what is actually moving

A hosting move can leave the domain, paths, language prefixes and HTTPS scheme exactly as they are. Write those invariants at the top of the change record. If a product currently lives at a particular path, its address should open the same product after the switch. Combining a server move with a domain rename or permalink redesign makes a missing redirect much harder to distinguish from an incomplete deployment.

Trace the path of one real request. The registrar holds the domain registration, the authoritative DNS provider publishes its records, and a CDN may accept the visitor connection before contacting the origin. These can be three separate accounts. A site already behind a proxy may need only an origin change in the CDN dashboard. Moving nameservers at the same time can disturb mail delivery, domain verification and unrelated subdomains.

Build a small acceptance set

Choose a popular landing page, an older article, an archived image, a language variant, a redirected URL and a deliberately missing path. For a shop, add one product with variants and the cart. Record the expected status, destination, canonical and visible content for each. Save a screenshot of the cart total and the latest accepted order identifier. These observations make a more useful handover than a note saying the homepage loaded.

Item to inventory Where to look What to carry over
WordPress runtime Site Health and hosting panel PHP version, extensions, memory limits and scheduled jobs
Persistent files Deployment and storage configuration Uploads, custom themes, plugins, private files and object storage access
Public traffic DNS zone and CDN origin settings A and AAAA records, proxy mode, certificate names and redirect rules
Business transactions Order system and delivery logs Last order, pending callbacks, payment state and queued mail

Build a recoverable copy before scheduling the cutover

Take the first copy while the old host still handles visitors. Use the provider’s snapshot or export a database dump to a private backup directory outside the public document root. Check the available space first. A database export, temporary archive and extracted files can occupy the disk simultaneously. On shared hosting, also check the file-count quota. A restore can finish copying large uploads and then fail on thousands of small plugin files.

Run these checks from the directory containing the installation, using the account that maintains it. Set the dump path to a location you own on encrypted or access-controlled storage. The example uses a consistent transaction for transactional tables. Ask the database operator how to snapshot any nontransactional tables and suspend schema changes during the export.

wp core version
wp option get home
wp option get siteurl
wp plugin list --status=active
umask 077
wp db export "$PRIVATE_DUMP" --single-transaction
sha256sum "$PRIVATE_DUMP"

A matching checksum confirms the bytes arrived intact. A rehearsal import tells you whether the destination database can use them. Create an empty, isolated database for the rehearsal. Verify the destination name, database user and table prefix before importing anything. Compare a few meaningful records, including a recent order or submission and an older attachment. A count of posts alone can look correct when the active application uses a different prefix.

Inspect the destination configuration separately from the copied files. Supply the new database credentials through the host’s secret mechanism. Check filesystem paths, cache endpoints and outbound mail settings. A cloned host pointing at the live Redis instance or production mail transport can change customer-visible state during a rehearsal. Keep scheduled tasks and queue workers paused on the clone until it becomes the writer. The WordPress migration handbook covers the files and database together. If the destination returns an empty page with the new PHP version, follow the WordPress fatal error checks and keep the log entry before rolling back.

Preview the real hostname on the destination

Provision TLS for every hostname you serve, including the name that redirects to the primary domain. A visitor using the old spelling must complete the TLS handshake before receiving a redirect. Arrange certificate issuance with your provider ahead of the traffic switch. DNS validation is one option when the public A record still points to the old host. Check which system will renew the certificate after the migration.

For a direct-to-origin site, use your actual public hostname and the destination address supplied by the new host. The curl override changes address resolution for that request while retaining the hostname for HTTP and TLS. Request the body as well as the headers for at least one important page. A default virtual host can return a perfectly valid 200 response containing the wrong site. A 502 on the destination calls for checking the gateway connection to PHP-FPM or Node before changing public DNS.

curl --resolve "$SITE:443:$NEW_IPV4" -sS -D headers.new -o landing.new "https://$SITE$LANDING_PATH"
curl --resolve "$SITE:443:$OLD_IPV4" -sS -D headers.old -o landing.old "https://$SITE$LANDING_PATH"

For browser testing, a temporary hosts file entry on your own machine lets you open the real address against the destination. Record the override and remove it before checking public DNS. Open DevTools and inspect the remote address, image requests and form response. A CDN with restricted origin access needs its provider-supported preview route. A direct origin request cannot prove that the edge is sending the correct scheme or forwarding the correct host.

Try the published URL for an older upload and a page with a custom permalink. Sign in to the rehearsal copy with an authorised account. Submit a form using a mail sink, and check the stored submission as well as the onscreen acknowledgement. If HTTPS repeatedly redirects back to itself, follow the WordPress reverse proxy redirect diagnosis before directing visitors to that route. If an existing upload returns 403 at the destination, use the 403 Forbidden diagnostic guide to check directory permissions and identify which layer refused the request.

Choose how to handle writes during the final sync

List everything that can create state while you copy. Editors save drafts, visitors place orders, payment providers deliver callbacks and scheduled actions update subscriptions. Closing checkout does not stop all four. Decide who will pause each writer, where callbacks can be queued and how to recognise an already processed payment. Do a timed rehearsal with production-sized data to estimate the actual interruption you need.

Pros and cons

Use a first file sync for the bulk of the media library, then estimate the remaining transfer. For SSH-based transfers, check the source and destination directories in a dry run. A trailing slash on the source copies its contents. Review the itemised list, especially any file with a destination-specific configuration. Limit the sync to directories the old installation owns. Keep the host’s certificate files, credentials and deployment settings outside that transfer.

rsync -an --itemize-changes "$SOURCE_UPLOADS/" "$DEST_UPLOADS/"

At the agreed freeze, record the timestamp in UTC and the last accepted transaction. Finish or safely pause pending jobs. Take the final dump and media delta, restore them, then reconcile the final order total and newest upload on the destination. Reopen writes in only one place. If some clients still reach the old host, give them read-only content or a maintenance response until they can use the new writer. Keep the payment provider’s delivery and retry records for reconciliation.

Switch traffic and observe both ends

Look up the authoritative record before changing its TTL. If the old TTL was 86,400 seconds, some resolvers may retain an earlier answer for up to a day. Lowering the TTL shortly before the cutover does not shorten a cached answer already issued with the higher value. Schedule the reduction at least one old TTL ahead when possible and confirm the lower value at the authoritative server.

dig @"$AUTH_NS" "$SITE" A +noall +answer
dig @"$AUTH_NS" "$SITE" AAAA +noall +answer
curl -sS -o /dev/null -w '%{http_code} %{remote_ip} %{time_total}\n' "https://$SITE$LANDING_PATH"

Change the records or the CDN origin identified in your plan. An old AAAA record can take IPv6 clients to the retired machine even after the A record is correct. Compare authoritative answers with the recursive resolvers your audience uses. Inspect the access logs on both hosts over the same interval. A public DNS check shows the answer returned to one observer. Requests reaching the old host reveal the visitors and integrations that still need attention.

Observation Distinguishing check Action
Only some phones show stale pages Compare IPv4 and IPv6 answers and origin logs Correct the stale address and keep the old origin available
Home works, product paths return 404 Request the same known product on each origin Restore the destination permalink rewrite configuration
Payments succeed but orders remain pending Match provider delivery IDs with callbacks on each host Reconcile the missing event using the provider’s replay controls
HTML loads, older images fail Check one failed media URL and the backing object or file Restore the missing asset or correct the storage configuration

Run the SEO and performance checks on the public address

Remove your hosts override and repeat the original acceptance set as a signed-out visitor. Follow a known redirect in the redirect chain checker using the observed responses. Confirm that a real missing page still returns 404. Inspect the HTML canonical, language alternates and robots meta, as well as the X-Robots-Tag response header. A staging noindex header can survive a database restore because the web server adds it after WordPress renders the page.

Fetch the live sitemap and check one child file with the XML sitemap checker. Open several listed URLs and confirm their final status. Use the Reproleaf workspace for the page check and keep the webmaster tool catalogue with your release notes. In Search Console, inspect the live URL for a representative page, then monitor crawl errors and index coverage over subsequent days. A successful live test and an updated index entry describe different moments. Google documents this distinction in its hosting move guidance.

Compare performance using the same page, region, device profile and cache state as before. Record the first request after a cache purge separately from the warmed page. The English comparison of PageSpeed Insights and GTmetrix explains how test conditions affect the reading. The full speed measurement guide in Russian covers how to interpret LCP, INP and CLS together.

Keep the rollback decision tied to transaction history

Before the destination accepts its first write, returning traffic to the original service is usually a routing decision. Once a new order, upload or account exists only on the new host, switching DNS back can make that record disappear from the working application. Record the first new transaction and keep one person responsible for deciding which database is authoritative. If the frontend fails while the database is healthy, restoring the frontend against the current data may be safer than restoring an older database.

Close the change only after checking mail delivery, cron execution and a representative payment or form submission on the live service. Look at scheduled tasks over a full relevant cycle, including overnight exports if the business relies on them. Keep backups and the old service for the retention window agreed with the owner. Remove the preview override, temporary credentials and obsolete DNS entries when the traffic and reconciliation records support that decision.

Frequently asked questions

Does a host change require new 301 redirects?

Existing public addresses can stay unchanged. Recreate the redirects that already served old URLs and verify their destinations on the new host.

Do I need to replace the domain in WordPress?

For an unchanged public hostname and scheme, keep the existing public URL settings. Review absolute filesystem paths in custom code and plugin settings separately.

How long should I leave the old host running?

Use the previous TTL, old-origin traffic and business reconciliation to set the window. A payment callback scheduled for later can still need attention after ordinary page traffic has moved.

Can I guarantee zero downtime by lowering DNS TTL?

TTL controls how long a resolver can reuse an answer. Continuous checkout also requires a single writable database, working sessions and a way to handle callbacks throughout the transition.

What should I do if the destination is slower?

Compare the time spent waiting for the HTML response with the time spent fetching the main image. Investigate the database, application cache or media delivery according to which interval changed, then repeat the same measurement.

← Back to blog

Need help with your website?

Development and SEO services →

Related articles