---
title: "How do I migrate my old sites over with rsync?"
url: "https://ploi.io/documentation/domains/how-do-i-migrate-my-old-sites-over-with-rsync"
published: "2021-06-26"
last_updated: "2021-06-26"
---

# How do I migrate my old sites over with rsync?

Whether you're coming from an old host, or your wanting to move all your sites to a new server, migration sounds hard but really isn't that hard.

In this guide, we'll describe you how to easily manage this with **rsync**.

We'll start with your **old server**, we're going to need to find the public key to be added to your **new server**. Log into SSH into your **old server** as the user that runs the websites.

Run this command to get that:

```
cat ~/.ssh/id_rsa.pub
```

This should give you a key like:

```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD4SNuSYi5uaLNVjEGMbE2....
```

Grab that key, and add that key to your **new server** via the **authorized\_hosts** file inside **~/.ssh/authorized\_hosts**, with Ploi you can easily add this key via the UI:

![](https://ploi.io/storage/jRywThtY4SwSf3trmJZgMoQqJoVMLdOQBCKqWYhl.png)

Now make sure the **new server** has the domain already created that you want to migrate over. It is also advised the folder in the **new server** is empty for that domain

And then we're going to run the command on the **old server** to rsync everything over:

```
cd /home/ploi/domain.com

rsync -rt * ploi@12.34.56.78:/home/ploi/domain.com
```

The flags mean the following:

- **r** means recursive, we want each subdirectories &amp; files as well
- **﻿t** means preserve modification times

The wildcard **\*** means grab anything in the folder we cd'ed into.

More information on the flags for rsync can be found [here](https://linux.die.net/man/1/rsync).