Migrating a WordPress site to another platform: the method

A successful migration is invisible. On switch day, visitors reach the new site through the same URLs, search engines find every page again, and email keeps arriving. This guide sets out the method for moving a site off WordPress in that order, from the first backup to shutting down the old install.

Simon Vasconcelos Lee By Published on 1 December 202611 minute read

All guides Build and run a website

In short

  1. Take a full backup of the site, files and database, before anything else.
  2. List every URL that matters: the sitemap, indexed pages, pages that get visits, images and documents linked from other sites.
  3. Export the content, copy the media, collect the SEO titles and descriptions.
  4. Rebuild the site keeping the same URLs wherever you can, and write a 301 redirect for every one that changes.
  5. Test the new site on the real domain before the switch, then point the DNS at it.
  6. Keep redirects for at least a year, watch Search Console, then delete the old WordPress install.

1. Prepare: backup, freeze, inventory

The first backup is both your safety net and your source. Take it from the site exactly as it is, before a single line changes:

Terminal, from the site root
wp db export backup-before-migration.sql
tar -czf uploads.tar.gz wp-content/uploads

Without WP-CLI, export the database from phpMyAdmin (Export tab) and copy the files over SFTP. Then set a content freeze date: from that day on, no more edits on the old site, or they will be lost. This is also when you list the plugins and the features that will need replacing.

2. The URL inventory

The URL list is the backbone of the migration: every line needs a place on the new site, or a redirect. Build it from three sources, which never quite overlap:

Terminal: every published page and post, with its URL
wp post list --post_type=page,post --post_status=publish --fields=ID,post_type,post_title,url --format=csv > urls.csv

3. Export the content

The Tools > Export screen in WordPress produces an XML file (in WXR format) holding pages, posts, categories, tags and comments. It holds the URLs of your images, not the images themselves: those come from the copy of wp-content/uploads. Theme settings, widgets and plugin settings are not in it.

Terminal: the same export from the command line
wp export --dir=./export

SEO titles and descriptions typed into a plugin are stored as page metadata. Collect them before you leave:

Terminal (replace 123 with the page ID; Rank Math uses rank_math_title and rank_math_description)
wp post meta list 123 --keys=_yoast_wpseo_title,_yoast_wpseo_metadesc

Finally, clean up the copy: a site built with Elementor, Divi or WPBakery comes out mixed with shortcodes or layout data, and internal links often carry the old site’s full address.

4. Rebuild, keeping the URLs

The safest redirect is the one you never need. Wherever the new platform allows it, reuse each page’s exact URL, trailing slash included. Carry over the title, the description, the headings and the image alt text. Point internal links straight at the new URLs rather than through redirects.

5. The redirect map

Every URL that changes gets a permanent redirect (301 or 308) to the page that replaces it, or to the closest page in meaning when it disappears. Redirecting the whole site to the home page loses the rankings of inner pages: Google may treat those redirects as missing pages (so-called soft 404 errors). The WordPress-specific URLs are the ones people forget:

WordPress URLExampleWhat to do
Dated posts/2024/03/my-post/Redirect to the post on the new site
Categories and tags/category/news/, /tag/offer/To the matching list, or to the closest section
Author pages/author/admin/To the About page or the blog home
Pagination/page/2/, /category/news/page/3/To the first page of the list
RSS feeds/feed/, /comments/feed/To the new feed if there is one, otherwise to the post list
Short URLs/?p=123, /?page_id=45To the matching page
Attachment pages/my-post/photo-1/To the post that contains the image
Media/wp-content/uploads/2024/03/prices.pdfKeep the same path, or redirect each file linked from elsewhere

Keep the map in a spreadsheet, one row per old URL, then load it into the redirect tool of the new platform or host.

6. Test before the switch

Test the new site on the real domain, before the DNS changes, by pointing the domain at the new server on your own computer only. This command does it for a single request, without changing anything:

Terminal (replace 203.0.113.10 with the new server’s IP address; on Windows, type curl.exe)
curl -I --resolve www.your-site.com:443:203.0.113.10 https://www.your-site.com/2024/03/my-post/

To browse, add the same mapping to your hosts file (C:\Windows\System32\drivers\etc\hosts on Windows, /etc/hosts on macOS and Linux). Then run through the URL list: every line must return 200, or a 301 to a page that returns 200. Check the contact form, the HTTPS certificate, the versions with and without www, and how the site looks on a phone.

7. The switch

  1. A few days before, a week if you can, lower the TTL of the site’s DNS records, for example to 300 seconds, so the change spreads within minutes.
  2. On the day, change the A and AAAA records (or the www CNAME) to point at the new site. Leave the email MX and TXT records alone.
  3. Check from a device outside your network that the new site answers, then run through the URL list again.
  4. Raise the TTL back to its usual value once everything checks out.

8. After the switch

9. Shut down the old install

Once the new site is stable, delete the old WordPress install, database included, rather than leaving it online on a subdomain or in a folder. A forgotten WordPress site gets no more updates and stays a way into the hosting account, and into every site that shares it. Keep the first backup off the server, then cancel the hosting once nothing depends on it, email included.

A migration done for you, and a site looked after afterwards

With Serenity by Simafri, we take over your WordPress site: we rebuild it, keep your URLs and your rankings, host it, secure it and keep it up to date. No third-party components for you to update, no admin exposed online. Domain name free for the first year and registered in your name, professional email included.

Discover Serenity by Simafri

Frequently asked questions

How long does it take to migrate a WordPress site?

For a business website of about twenty pages, preparation, rebuilding and testing take days; the switch itself takes minutes if the TTL was lowered in advance. What makes it longer: the number of URLs to carry over, a page builder to clean up, and plugin features to replace.

How long should I keep 301 redirects?

At least a year, and as long as you can. Google recommends keeping them for a minimum of one year, and links published elsewhere will keep pointing at the old URLs long after.

Can I migrate a WordPress site without downtime?

Yes. The new site is built and tested alongside the old one, on the real domain thanks to the hosts file, and then only the site’s DNS records change. With the TTL lowered in advance, the switch takes minutes, and the old site still answers visitors whose DNS has not caught up yet.

What happens to my images in Google Images?

They keep their place if their URL stays the same, or if each old URL redirects to the new image. The simplest approach is to keep the /wp-content/uploads/ paths on the new site, or to redirect that folder as a block to its new location.

Contact us