Migrate your website without losing SEO

Move host, change URLs or switch domains while keeping your search traffic, email and links intact.

A cardboard moving box beside a terracotta signpost pointing the way

Search engines rank URLs, not websites. When those URLs change, or stop answering, the rankings attached to them have to be passed on deliberately. A migration done carefully usually settles within a few weeks. One done carelessly can lose pages from the index for months.

This guide is for anyone moving a site to a new host, changing its URL structure or switching to a new domain. By the end you will have a checklist that covers redirects, on-page signals, Google Search Console, DNS timing and email. Be realistic, though: even a well-run migration can see some ranking movement while search engines recrawl, and nobody can promise otherwise.

Know which kind of migration you are doing

There are three kinds, with rising risk:

  • Host move only. Same domain, same URLs, new server. Search engines barely notice if the content and URLs are identical.
  • URL changes. New CMS, new structure or a switch to HTTPS. Every changed URL needs a redirect.
  • Domain change. Every URL changes. Redirects plus a Search Console change of address.

If you can, avoid combining a domain change with a redesign. When rankings move, you want to know why.

Step 1: inventory every URL

You can't redirect what you haven't listed. Build one spreadsheet of every URL that matters, from:

  • your current XML sitemap
  • a full crawl with a site crawler (several desktop and hosted tools do this)
  • the Pages and Performance reports in Google Search Console, exported
  • landing pages in your analytics
  • the Links report in Search Console, for pages other sites link to

For each URL, record the status code, title, meta description and canonical. Keep this crawl: after launch you will compare against it.

Step 2: build a one-to-one redirect map

Map each old URL to the most relevant new URL, and use a 301 (permanent) redirect. A 308 is also permanent and search engines treat it the same way. A 302 is temporary and the wrong choice for a migration.

Avoid sending everything to the homepage: search engines tend to treat that as a missing page. If a page truly has no equivalent, let it return 404 or 410. Avoid chains as well; if /a already redirects to /b, point /a straight at the final URL.

Keep the map as a simple CSV so any server can use it:

Text
old,new
/about-us.html,/about
/services/web-design.php,/services/web-design
/blog/2023/hello-world.html,/blog/hello-world

nginx

If the new site runs behind nginx, turn the CSV into a map file:

Terminal
awk -F, 'NR > 1 { printf "%s %s;\n", $1, $2 }' redirects.csv > /etc/nginx/redirects.map

Then load it and redirect matching paths, keeping any query string:

nginx
# inside the http block
map $uri $new_uri {
    default "";
    include /etc/nginx/redirects.map;
}

server {
    listen 80;
    server_name example.com;

    if ($new_uri) {
        return 301 $new_uri$is_args$args;
    }

    # the rest of your site configuration
}

For a domain change where paths stay the same, the old domain needs one server block. It must still have a valid certificate, or HTTPS visitors see a warning before the redirect:

nginx
server {
    listen 80;
    listen 443 ssl;
    server_name old-example.org www.old-example.org;
    ssl_certificate     /etc/ssl/old-example.org/fullchain.pem;
    ssl_certificate_key /etc/ssl/old-example.org/privkey.pem;
    return 301 https://example.com$request_uri;
}

Next.js

In Next.js, redirects() in next.config.js handles the map. With permanent: true Next.js sends a 308.

JavaScript
module.exports = {
  async redirects() {
    return [
      { source: '/about-us', destination: '/about', permanent: true },
      { source: '/news/:slug', destination: '/blog/:slug', permanent: true },
    ];
  },
};

For hundreds of entries, generate this array from the CSV rather than typing it.

Step 3: keep the on-page signals

Redirects pass signals on, but the new page still has to deserve its ranking. Carry over:

  • Titles and meta descriptions, unless you are deliberately improving them
  • Headings and main content, so the page still answers the same query
  • Canonical tags, pointing at the new URL on the new domain, never the old one
  • Structured data, such as product, article or organisation markup
  • hreflang tags, if you serve several languages

Update internal links to point straight at new URLs instead of relying on redirects.

Step 4: avoid robots.txt and noindex traps

The most common migration failure is a new site launched with its test settings still on. Before launch, check that:

  • robots.txt doesn't contain Disallow: /
  • no page carries <meta name="robots" content="noindex"> or an X-Robots-Tag: noindex header
  • the old URLs aren't blocked in robots.txt, because search engines must crawl them to see the redirects

A safe production robots.txt:

Text
User-agent: *
Disallow:

Sitemap: https://example.com/sitemap.xml

If you test the new site on Launchpad first, its remotegeeks.online address keeps working after you connect your domain. Make sure canonical tags point at your own domain so search engines don't treat the two as duplicates.

Step 5: sitemap and Google Search Console

Publish an XML sitemap listing only new, final URLs that return 200. Then, in Search Console:

  1. Verify the new site before launch. A Domain property, verified with a DNS TXT record, covers every subdomain and both HTTP and HTTPS.
  2. Submit the new sitemap.
  3. For a domain change only, use the Change of Address tool from the old property once the redirects are live. It doesn't apply to host moves, HTTPS switches or URL changes within the same domain.
  4. Watch the Pages report for new errors and redirect problems.
Old URLs redirect to new ones while the sitemap and Search Console point crawlers at the new site
Each old URL 301-redirects to its new equivalent; the sitemap and Search Console speed up recrawling

Step 6: time the DNS switch

A day or two before launch, lower the TTL on the records you will change (usually the A or CNAME for the site) to 300 seconds. Wait at least the old TTL so caches pick up the short one. On launch day, change the record, check it with dig +short A example.com, then raise the TTL again once things are stable. On Launchpad, the custom domain guide walks through the records and the automatic certificate.

Step 7: keep email working

Moving a website only changes the records for the website. Your MX records, and the SPF, DKIM and DMARC TXT records, should stay exactly as they are.

The risk comes when you change nameservers: every record moves to the new DNS provider at once. Copy every existing record across first, especially MX and email TXT records, and compare with dig +short MX example.com before and after. If you are transferring the domain to a new registrar, website and email keep working as long as the nameservers don't change.

After launch: check and monitor

Run your old URL list against the live site:

Terminal
while IFS=, read -r old new; do
  [ "$old" = "old" ] && continue
  printf '%s -> ' "$old"
  curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' "https://example.com$old"
done < redirects.csv

Every line should show 301 (or 308) and the right destination. Then, over the following weeks, watch 404s in your logs and Search Console, compare a fresh crawl against your original one, and set up an external uptime monitor. Expect some movement in rankings while pages are recrawled.

Common mistakes

  • Redirecting everything to the homepage. Map each page to its real equivalent.
  • Launching with noindex from staging. Check headers and meta tags on the live site.
  • Canonicals still pointing at the old domain. Search engines may keep the old URLs.
  • Removing redirects too soon. Keep them for at least a year, ideally permanently.
  • Letting the old domain expire. Keep it renewed, with auto-renew on.
  • Forgetting MX records in a nameserver change. Copy every record first.

Security notes

  • Never build redirects from user input such as ?next=; that creates an open redirect others can abuse.
  • Keep a valid certificate on the old domain for as long as it redirects.
  • Protect a pre-launch copy of the site with a password rather than relying on noindex alone.
  • An expired old domain can be registered by someone else and used to exploit the links and trust it still has.

Troubleshooting

SymptomLikely causeFix
New pages not indexed after weeksnoindex or Disallow: / left onRemove it, resubmit the sitemap
Old URLs still showing in resultsRedirects are 302s or chainsUse single 301s to final URLs
Spike in 404sMissing entries in the redirect mapAdd the URLs from your logs to the map
Certificate warning on old domainNo certificate after the moveKeep HTTPS on the old domain
Email stopped after launchMX records lost in a nameserver changeRe-add the provider's MX records

Frequently asked questions

How long should I keep the redirects?

At least a year, and longer if you can. Other sites keep linking to old URLs long after search engines have updated.

Will I lose rankings?

Some fluctuation is common while search engines recrawl. Clean one-to-one redirects and unchanged content give you the best chance of recovering quickly.

Do I need Change of Address for a host move?

No. It is only for moving to a new domain. A host move with identical URLs needs no Search Console action beyond watching the reports.

Should I change domain and redesign at the same time?

It is safer to separate them, so you can tell which change caused any drop.

Next steps

A migration is mostly preparation: an inventory, a redirect map and a careful DNS switch. Do those well and the rest is monitoring.

Share this articleLinkedIn (opens in a new tab)X (opens in a new tab)Facebook (opens in a new tab)
Was this article helpful?

Get new guides in your inbox.

One email a month. Unsubscribe anytime.