How-to Transfer a WordPress Site
If you are hosting your own WordPress site and you want to move because the current hosting company is slow, unstable, expensive, etc., you can transfer your WP site very easily. It takes almost no time. This is also a good way to transfer sites even if it isn’t a WP site, just skip the database steps. Once you have done this a few times you will never understand why you used to download everything onto your computer and then upload it to the new server.
Requirements to transfer using this method:
- SSH access on both hosting companies (it will say on their site, or call them)
- PHPMyAdmin on both servers. You can use command-line MySQL, but if you know that your probably aren’t in need of this article.
- Basic knowledge of Unix would help
Step 1: Transfer Your Files
This will copy your files from your old hosting to new hosting company.
- ssh -p 22 username@oldhosting.com
- cd www
- scp -r -P 22 * username@your-domain.com:/home/username/www
- password: (type in your password)
Explaination:
- SSH into your old hosting (you might not have to specify port number 22)
- Change Directory into your web files directory. Most companies give will make you put them in one of these folder: www, public_html, or httpdocs
- The tricky step here
- scp – stands for Secure Copy, it copies files through encryption
- -r – Recursive, it will copy everything in your “web” folder, and sub directories
- -P 22 – this is not needed if your new hosting company runs SSH over port 22 (doesn’t hurt to keep it though). if the company does not run it over 22, change it to whatever it maybe (maybe 7822 in some cases, but rare)
- * – means everything, if you want to only copy one file, like wp-config.php you would change the * with wp-config.php
- username@127.0.0.1 – this will be whatever your username and domain is (specifically your SSH username, might be the same as your control panel) and the IP address of your new server. If you have already transferred your domain to the new server you will have to SSH into the old server via IP address
- :/home/username/www – this tells scp where to write the files once it starts transferring. “username” is whatever was assigned to you, and “www” could be “public_html”, “httpdocs” etc.
- it might ask ‘Are you sure you want to continue?’, type in yes)
- password: (you should know this)
Your transfer should be going after you type in that password. The transfer of the files normally takes 60-120 seconds.
Step 2: Change Your URL (optional)
If you are transferring from old host to new host with the *SAME* domain, you can skip this step. If not, make sure you change your URL.
- Login to the admin on your old server
- Go to Stettings > General
- Change these two settings to your new domain “WordPress address (URL)” and “Blog address (URL)”
If you do not do these steps all of the links will be pointing to your old domain. This is where WordPress is stupid, IMHO. They should not store the URL in the database, it should all be in the wp-config.php file. Maybe I’m missing the developers logic.
Step 3: Export Your Database
Get into the control panel on your old hosting company. Get into PHPMyAdmin. I wish I could give you more details than that, but every control panel is different.
Once in PHPMyAdmin
- Select the correct database by click on it on the left
- Click on Export (one of the main tabs)
- Now make your screen look like mine:

- Hit Go
- Save the file on your desktop
Step 4: Importing Your Database
This is very similar to the previous step, but backwards. I’m going to be lazy and tell you this, without steps. Login to the new server and import the file you just created with step 3.
Step 5: Change Your Config File
SSH into the new server and make these changes to your new settings:
define(’DB_NAME’, ‘ishinelight’);
define(’DB_USER’, ‘ishinelight_wp’);
define(’DB_PASSWORD’, ‘SomethingSafe’);
define(’DB_HOST’, ‘localhost’);
Step 6: Done.
Browse to your new blog and you are golden.