In this tutorial, I’ll show you, step by step, how to manually move your WordPress site or blog to a new host with minimal downtime.
There may come a time, for whatever reason, that you decide you need to migrate your WordPress site to a new host. Sure, moving a website from one web host to another can seem like a very daunting task, but by following the below steps you’ll be able to transfer your website in the best way possible.
Manually Moving Your WordPress Site to a New Host will involve the following steps:
- Backup WordPress Files and Database from old host.
- Upload Files to new host.
- Create a database on your new host.
- Import Database copy into newly created database.
- Update wp-config.php file with the new database details.
- Update nameservers.
Just a word of caution: Migrating your site to a new host on your own can be tricky, and we can’t offer a “no downtime” guarantee. But if you follow these instructions carefully, your site shouldn’t experience any significant downtime.
Step 1: BackUp your WordPress Files and Database from old host
Before you do anything else, it is extremely important that you make sure you have a backup copy of your website files and database. That way, if something goes wrong, you can revert back to the state it was before and start again with your backup.
Be sure to have a backup copy of the following:
- Files (wp-content folder & .htaccess file)
The backup can be done manually using cPanel’s File Manager or FTP client and phpMyAdmin.
If you’d like detailed tutorial on how to create a manual backup of your files and database, then check out the article:
Prior to a full backup of your WordPress blog, you’ll need to do some cleanups to reduce the size of your backup.
a) Delete unused plugins and Themes
b) Optimize your database using WP Optimize plugin
c) Delete spam comments
d) Delete trash posts and pages
Step 2: Transfer your Files to a New Host
Now that you have the backup files stored safely on your local computer, it is time to upload those files to your new host.
I am assuming you have FTP, such as FileZilla already downloaded and installed on your computer.
- Connect to your hosting account via FTP.
- Navigate to the public_html folder and upload the website files (wp-content folder and .htaccess file) that you just downloaded from your old host.
(Note: Be sure to overwrite the existing wp-content folder with the one you downloaded from your old host.)
Step 3: Create a new database on your new host
Now you need to create a new, empty database on your new host.
- In your cPanel: Navigate to the Database Tools section and click MySQL Wizard.
- In the New Database field, enter a name of your choice and click Next.
- Next, give your database a username (you can use the same name as your database) and password (use the password generator to create a strong password). Click Create User.
- On the next screen, select “All Privileges” and click Next.
Be sure to note down the database name, username, and password, as you will need these details later.
For the purposes of this tutorial, i’ve created the database with the following credentials:
- Database name: makeawf0_nam
- Database username: makeawf0_nam
- Database password: G4#kFTIV9t033
Step 4: Import Database copy into newly created database
Now you are ready to import the .sql file you downloaded into newly created database. To do this, follow these steps:
- Click phpMyAdmin in the Database section of your cPanel.
- In the left pane of phpMyAdmin, click on the database that you created in step #3.
- Click Import tab at the top.
- Under File to Import, click
- Click Go button to begin the import.
If the import was successful, you should see the success message as shown below.
Step 5: Edit wp-config.php file
Now you’ll need to edit the wp-config.php file to connect the files with the database on your new host.
To do this, go to the File Manager in your cPanel and open your public_html folder. Then locate the wp-config.php file, right-click on it and click Code Edit. You’ll see the login credentials for your database like this:
define( 'DB_NAME', 'database_name_here' ); // name of database
define( 'DB_USER', 'username_here' ); // MySQL User
define( 'DB_PASSWORD', 'password_here' ); // Password
define( 'DB_HOST', 'localhost' ); // MySQL host
You will need to replace them with the new database information (database name, username and password) you created in step #3. The MySQL hostname should be usually localhost so leave it as it is. Here’s how my wp-config.php file looked after making these changes.
Also, make sure that the
$table_prefix variable in wp-config.php matches the prefix of the database tables that you just imported from the backup. To confirm the table prefix, use phpMyAdmin to log into the database.
- Once logged in, click on the newly created database name on the left. You’ll see a list of tables appear underneath.
- In our example, the table name begin with ‘wp_’ is the prefix.
- Go ahead and update your wp-config.php file’s prefix variable to match this table prefix (as shown in image below).
Note that prefixes always end with an underscore.
Once you have updated those, click Save Changes. Your wp-config.php file should now reflect the newly created database name, user and password.
Note: If your wp-config file wasn’t updated with the correct details, your site will not display any content and you will receive a “database connection error”. If you are unsure of what you are doing, it’s better to contact your hosting company and ask them to update the wp-config.php file for you.
That’s it! You have successfully moved your WordPress site to a new host!
Step 6: Update Nameservers
Note: Perform this step only if you are switching hosts. If you are moving WordPress site within the same host then this step will not be necessary.
The final step is to update the DNS or name servers for your domain to point to your new host. For example, Bluehost uses: ns1.bluehost.com and ns2.bluehost.com.
Log into your domain registrar and set your nameserver records to:
Save the changes and wait for them to take effect.
Sometimes it could take up to 24 hours for name server changes to propagate fully, but typically you may see the switchover within the hour.
You’re done! Now go ahead and test your site to make sure everything looks correct and is working exactly as it was before the migration.
As you can see, it is not that hard to move WordPress to another host when break down the process into the above simple steps. Even if you’re new to the process of moving WordPress, there really is no need to be afraid as long as you have your site backed up.
I hope this article helped you move WordPress site to a new web host. If you have any questions, let me know in the comments below!