How to Roll Back to Your Old Host After a Failed Migration
To roll back a failed hosting migration, you keep the old account live and untouched until the new one has proven itself, then you repoint DNS back to the old server and restore any data written to the new host in the meantime. The whole thing works only if you planned the fallback before you started, so this covers both the plan you should have made and the recovery you run when the new host turns out to be worse.
Before you migrate: the things that make roll back failed hosting migration possible
The single most common reason a rollback goes badly is that the old host was cancelled the day the new site went live. Do not do that. Keep the old account paid and running until you have watched the new one through a full traffic cycle, at least a couple of weeks. If cancelling early is the mistake that cannot be undone, everything below is the set of mistakes that can.
Lower DNS TTLs well before cutover. If your zone still has a default TTL of a day, a rollback takes a day to propagate. Drop the TTL on the records you will change (A, AAAA, CNAME) to something short a day or two ahead of the migration, then raise it again once you are confident. A short TTL is the cheapest rollback insurance there is.
Take a cold copy of everything on the old server before you touch DNS: files, databases, mail, cron entries, TLS material, and any config outside the document root. A plain archive plus a database dump is enough.
tar czf oldsite-files.tar.gz /var/www /etc/nginx /etc/apache2
mysqldump --single-transaction --routines --triggers mydb > oldsite-db.sql
ls -lh oldsite-files.tar.gz oldsite-db.sql
-rw-r--r-- 1 root root 412M oldsite-files.tar.gz
-rw-r--r-- 1 root root 88M oldsite-db.sql
Record the old server's IP addresses and the exact DNS records as they stand. A text file with the current zone is worth more than your memory at the moment things go wrong.
The rollback itself: DNS, the header, and the command
Rollback is mostly a DNS operation. Point the records back at the old server's addresses and wait for the short TTL to expire. Check propagation from a resolver that is not your local cache rather than trusting the browser:
dig +short example.com A @1.1.1.1
dig +short www.example.com CNAME @1.1.1.1
203.0.113.10
While DNS settles, you can move traffic immediately at the HTTP layer with a redirect. If the new host's web server is still answering for the domain, a 301 sends visitors to the old host at once. Use 302 during a rollback so browsers and search engines do not cache the move permanently:
# nginx, on the new host, until DNS has settled
server {
listen 443 ssl;
server_name example.com www.example.com;
return 302 https://old.example.net$request_uri;
}
If you would rather not depend on the new host at all, and you control the authoritative nameservers, you can also swap the records at the registrar or DNS provider directly. Either path works; the redirect is faster to deploy, the DNS change is more permanent.
The tricky part is data written to the new host after cutover. Users may have registered, uploaded files, or placed orders there. Before you pull the plug, freeze writes and export anything created since the migration. Compare row counts and recent timestamps between the two databases, then merge the new rows into the old database rather than overwriting it. Never restore the old database dump over live data, because that dump predates the migration and will silently discard everything since.
Verifying the rollback and closing the loop
Confirm the site actually serves from the old host before you declare victory. Check the response headers and the server address:
curl -sI https://example.com | head -n 5
HTTP/2 200
server: nginx
date: ...
content-type: text/html
Test the things that broke or that you changed during migration: login, checkout, mail delivery, TLS certificate validity, and any cron jobs. Mail deserves particular attention, because MX records may still point at the new host and mailboxes there may hold messages that never reached the old server. Copy those across or forward them before decommissioning anything.
Keep the new host running, but idle, for a few days after the rollback. If the old host turns out to be the problem too, you will want the option back. Only once the old site has run cleanly through a full cycle should you cancel the new account, and only then should you raise TTLs back to normal.
Finally, write down what failed on the new host and why. The rollback is not the end of the project, it is the pause before the next attempt, and the notes you take now are what make the second migration go better than the first.
What to do next
If you are reading this mid incident, the order is: drop the TTL if you can, add the 302 redirect on the new host, export anything written since cutover, then repoint DNS and verify with curl and dig before you touch anything else. If you have not migrated yet, lower your TTLs today and keep the old account paid until the new one has survived a full traffic cycle. The rollback plan costs you almost nothing to prepare and saves you an outage when you need it.
