How to Transfer a WordPress Website
The following is as simple but thorough a guide as I believe is possible to write with regards to transferring a WordPress website from one server to another. It covers moving both your files and the database, as well as what you’ll need to edit in both. Enjoy.
What You’ll Need
- Access to both server’s PHPMyAdmin (provided by most hosting control panels)
- FTP access to both servers
- Basic knowledge of how to use FTP
- A text editor like TextEdit on Mac or Notepad on Windows
The 7 Step Process
1. Download the Files from the Original Server
Using an FTP client like CyberDuck, login to the old server and download the files to your desktop.
- Download and install CyberDuck on your computer.
- Open the program and click Open Connection. You’ll be presented with a window similar to the one displayed here.
- Enter your credentials into the Server, Username and Password fields. These are usually all you need to successfully connect to your web server. You can call your old hosting company (where the site and files are currently hosted) to obtain this information.
- Upon connecting, you’ll probably be shown a bunch of folders. You want to find the one that contains your website install, it’s likely named html or public_html. You’ll know you’ve found it when you come across a folder that contains files like index.php, license.txt, readme.html and a variety of other files and folders that begin with wp-.
- Click on one of the files and then choose Edit > Select All from the menu at the top of your screen (or Ctrl+A on Windows, Command+A on Mac).
- Choose File > Download to from that same top menu. You’ll be presented with a window allowing you to choose a location on your computer. It’s probably best to create a new folder and download all of the files to that location.
The download process will likely take several minutes to an hour, depending on your connection. Do not interrupt this process!
2. Download the Database from the Original Server
Log into PHPMyAdmin via your old host’s control panel and export your database.
- Log into the existing site’s hosting control panel and dig around for an option to use PHPMyAdmin.
- You can find the login information for PHPMyAdmin in the wp-config.php file that you just downloaded in the previous step. Look for some code like this:
/** MySQL database username */
/** MySQL database password */
- You’ll see a screen similar to the one shown here. Choose your database from the list on the left, underneath the PHPMyAdmin logo and various icons. If there are multiple databases, here, refer to your existing wp-config.php file in the ‘DB_NAME’ line for the one you want to work with.
- After selecting the database, click the Export tab near the top of the page.
- If presented with the options to use the Quick or Custom export types, choose Custom.
- Make sure all of the tables are selected in the Tables box.
- Make sure Save output to a file is selected.
- Click Go. You’ll be prompted to save the file to your hard drive.
You now have a copy of your database on your local machine.
3. Modify wp-config.php
Open your wp-config.php file that’s been saved to your desktop in Step 1 above and edit your database settings.
- Make sure to have your new database’s name, username and a password, which you can get from your new host.
- Using Notepad on Windows or TextEdit on Mac, open up the wp-config.php file that you downloaded from your old server.
- Find the following line in that document:
Change whatever is in the
'yourDatabaseName'area to reflect your new database name. You can find this name at the top of PHPMySQL on your new server. See the following example for where you find the new database name (in this example case, it would be newDatabaseName).
- Next, find the following line:
Replace that with your new database username.
- Do the same with the new database’s username’s password, change that on the following line:
- Save that file.
4. Upload the Files to the New Server
Again, using your FTP client, connect to your new server and upload the files from your hard drive to that new server.
You can get the FTP login details for your new server from your new host, as well as ask them what folder (typically public_html or html) to place the new files in for your live directory.
5. Optional: Modify original Database
If you’re changing the domain name for the WordPress installation, for example if you were developing it on a test server at something like testserver.com and now want to move it to yourdomain.com, you’ll need to change your database to reflect that.
- Open up the database file you downloaded via Notepad or TextEdit.
- Press Ctrl+F on Windows or Command+F on Mac to do a Find and Replace.
- Enter in your old domain name, in this example it would be testserver.com, into the Find field, and yourdomain.com into the Replace field.
- Once you’ve Found and Replaced, save the file.
6. Import Database to New Server
Using PHPMyAdmin on the new server, import your database.
- Open up and log into PHPMyAdmin on your new server.
- Select your new database from the list on the left.
- Click Import from the menu near the top of the page.
- Click Choose File to locate the file on your hard drive and import the database.
- Click Go and the file will be imported.
7. Modify your Domain Name’s DNS Settings
If your domain name isn’t pointed at the new server, you’ll need to get your new DNS settings from your host and enter them into your domain name’s control panel settings.
This is different for every host and domain name registrar, and you’ll need to specifically get in touch with each of them to learn how to do this. Remember, you want to be doing this on the new server.
7. Visit Permalinks page
In WordPress, go to Settings > Permalinks to flush your permalinks settings to the new server.
That’s it! Your site will be up and running on the new server, though you may have to wait 2 – 24 hours for your DNS to point to the new server.