How to Migrate a WordPress Website Using SFTP

R

Rajat saini

Last updated on Jul 8, 2026

This guide explains how to move a WordPress website from one hosting provider to another using SFTP.

A WordPress website has two main parts:

  • Website files — themes, plugins, uploads, images, and WordPress files

  • Database — pages, posts, users, settings, products, orders, and plugin data

SFTP is used to move the website files securely. The database is usually moved using phpMyAdmin or another database management tool.


Before You Start

Make sure you have the following information:

  • SFTP login details for the old hosting account

  • SFTP login details for the new hosting account

  • Database access for the old website

  • Database access for the new hosting account

  • A file transfer app such as FileZilla, Cyberduck, or WinSCP

  • Access to the domain DNS settings

SFTP details usually include:

  • Hostname or server IP address

  • Username

  • Password or SSH key

  • Port number, usually 22


Step 1: Connect to the Old Hosting Account

Open your SFTP app and connect to the old hosting account.

Example:

Host: old-server.example.com
Username: your_username
Password: your_password
Port: 22
Protocol: SFTP

After connecting, find the website folder.

Common folder names include:

public_html
www
htdocs
domains/example.com/public_html

Inside the WordPress folder, you should see files and folders like:

wp-admin
wp-content
wp-includes
wp-config.php
index.php
.htaccess

If you see these files, you are in the correct WordPress folder.


Step 2: Download the WordPress Files

Download all WordPress files from the old server to your computer.

The most important folder is:

wp-content

This folder contains:

  • Themes

  • Plugins

  • Images

  • Uploads

  • Custom website files

For a full migration, download the complete WordPress folder, including:

wp-admin
wp-content
wp-includes
wp-config.php
index.php
.htaccess

Large websites may take longer to download.


Step 3: Export the WordPress Database

The database is required for a complete WordPress migration. Website files alone are not enough.

The database contains:

  • Pages

  • Blog posts

  • Users

  • WordPress settings

  • Plugin settings

  • WooCommerce products and orders, if applicable

Log in to phpMyAdmin or the database manager on the old hosting account.

Then:

  1. Select the WordPress database

  2. Click Export

  3. Choose Quick

  4. Choose SQL

  5. Download the .sql file to your computer

If you are not sure which database your WordPress site uses, open the wp-config.php file and look for:

define('DB_NAME', 'database_name');

The value beside DB_NAME is the database name used by the website.


Step 4: Create a New Database

Log in to the new hosting account and create a new database.

Save these details:

Database name
Database username
Database password
Database host

You will need them when updating the wp-config.php file.

In many cases, the database host is:

localhost

Some hosting providers may use a different database host.


Step 5: Upload the WordPress Files to the New Server

Connect to the new hosting account using SFTP.

Open the website root folder. Common root folders include:

public_html
www
htdocs

Upload all WordPress files from your computer to the new server.

Make sure the files are directly inside the website root folder.

Correct example:

public_html/wp-admin
public_html/wp-content
public_html/wp-config.php

Usually incorrect example:

public_html/wordpress/wp-admin
public_html/wordpress/wp-content

Do not upload the website into an extra folder unless your hosting setup requires it.


Step 6: Import the Database

Open phpMyAdmin or the database manager on the new hosting account.

Then:

  1. Select the new empty database

  2. Click Import

  3. Upload the .sql file

  4. Click Go or Import

After the import is complete, the database has been moved to the new hosting account.


Step 7: Update the wp-config.php File

Open the wp-config.php file on the new server.

Update the database details to match the new database:

define('DB_NAME', 'new_database_name');
define('DB_USER', 'new_database_user');
define('DB_PASSWORD', 'new_database_password');
define('DB_HOST', 'localhost');

Use the database name, username, password, and host from the new hosting account.

If the website shows Error Establishing a Database Connection, check the database details again.


Step 8: Update the Website URL If Needed

If the domain name is staying the same, you may not need to change anything.

If the website is moving to a new domain, update the WordPress website URL in the database.

In phpMyAdmin, open the WordPress database and find the options table.

It is usually called:

wp_options

Look for these two rows:

siteurl
home

Update both values to the new website URL.

Example:

https://newdomain.com

If your WordPress table prefix is different, the table may have a different name, such as:

abc_options

Step 9: Test the Website

Before changing DNS, test the website if your hosting provider gives you a temporary URL or preview link.

Check:

  • Homepage

  • Pages

  • Blog posts

  • Images

  • Menus

  • Contact forms

  • WordPress admin area

  • Checkout page, if using WooCommerce

The WordPress admin URL is usually:

https://yourdomain.com/wp-admin

Step 10: Point the Domain to the New Hosting Account

After confirming the website works, update the domain DNS.

Depending on your hosting provider, you may need to update:

  • Nameservers

  • A record

  • CNAME record

If the new hosting provider gives you nameservers, update the domain nameservers.

Example:

ns1.examplehost.com
ns2.examplehost.com

If the new hosting provider gives you an IP address, update the domain A record.

Example:

Name: @
Value: 123.123.123.123

DNS changes can take some time to fully update.


Step 11: Install SSL

After DNS points to the new server, install SSL for the domain.

Most hosting providers offer free SSL using Let’s Encrypt.

After SSL is active, your website should load using:

https://yourdomain.com

Also check for mixed content warnings. Mixed content usually happens when some images, scripts, or styles still load using http:// instead of https://.


Step 12: Refresh Permalinks

After migration, log in to WordPress admin.

Go to:

Settings > Permalinks

Click Save Changes without changing anything.

This refreshes WordPress rewrite rules and can fix 404 errors on pages and posts.


Step 13: Check File Permissions

Incorrect file permissions can cause errors after migration.

Common WordPress permissions are:

Folders: 755
Files: 644
wp-config.php: 600 or 640

Avoid setting files or folders to 777 because it is insecure.


Final Checklist

After the migration is complete, check the website carefully.

Make sure:

  • The website loads correctly

  • WordPress admin works

  • Images display properly

  • Contact forms send emails

  • Plugins are active

  • The theme looks correct

  • SSL is working

  • Permalinks are working

  • There are no broken links

  • CSS and JavaScript files are loading

  • WooCommerce checkout works, if applicable

After everything is working, create a fresh backup of the migrated website.


Common Migration Problems

Error Establishing a Database Connection

This usually means the database details in wp-config.php are incorrect.

Check:

  • Database name

  • Database username

  • Database password

  • Database host


Pages Show 404 Errors

Go to:

Settings > Permalinks

Click Save Changes.


Images Are Missing

The uploads folder may not have fully transferred.

Check this folder:

wp-content/uploads

If files are missing, upload them again using SFTP.


Website Redirects to the Old Domain

Update the siteurl and home values in the database.

You may also need to search and replace the old domain in the database.


White Screen or Critical Error

This may happen because of a plugin, theme, or PHP version issue.

To test plugins, rename the plugins folder using SFTP:

wp-content/plugins

Rename it to:

plugins-disabled

Then reload the website.

If the website works, one of the plugins is likely causing the issue.


Is SFTP Migration Safe?

Yes. SFTP is safe because the file transfer is encrypted.

However, SFTP only moves the website files. For a full WordPress migration, you must also move the database.

Always take a full backup before starting the migration.


Conclusion

Migrating WordPress using SFTP is a safe and reliable way to move a website to a new hosting provider.

The main steps are:

  1. Download the WordPress files from the old server

  2. Export the database

  3. Upload the files to the new server

  4. Import the database

  5. Update wp-config.php

  6. Test the website

  7. Point the domain to the new hosting account

  8. Install SSL

  9. Check the website carefully

When done correctly, this method can move a WordPress website with minimal downtime and without relying on migration plugins.

This version is good for a knowledge base because it is clean, step-by-step, and written for non-technical customers.