How to Copy a WordPress Site From One Domain to Another Manually

Migrating WordPress manually isn’t something you’d do in ordinary situations. With so many good migration tools, there’s little reason why you’d attempt a manual process.

But have you thought of a time when you cannot access your WordPress dashboard?

For instance, if a domain expires and you forget to renew it in time and lose access to it, you will not be able to access your website even if your web hosting subscription is still active.

In this case, you have to move the files manually to a new domain via FTP.

This is exactly what happened recently when I had to move a WordPress site to a new domain.

In this post I’m going to show you a tried-and-true method of moving WordPress from one domain to another manually.

The steps

There are two main steps to copy a WordPress site from one domain to another:

Export WordPress site

The first step involves transferring the WordPress files from the web server to your local computer. Additionally, you need to export the database file associated with your WordPress site.

Copy WordPress files from web server to local computer

For this step, I’m using FileZilla, a popular FTP client designed for remote file copying.

FileZilla enables you to establish a remote connection to your web server (in this case, your shared hosting server) and transfer files from a specified directory to a location on your computer.

Once you’ve connected to the remote server via FileZilla, navigate to the directory where WordPress is installed. Typically, this is the public_html folder for most shared web hosts.

Then, proceed to the desired folder where you intend to copy the files. Create a new folder on your computer for this purpose, just to stay neat and organized.

In FileZilla, both the source and destination folders should now be open in their respective panels.

In the web server panel on the right side, select the files you wish to copy by highlighting them, then right-click. Next, choose “Upload” from the menu and click on it.

This process may take some time to complete, possibly up to 60 minutes in certain cases. Let the process complete.

Export WordPress database

Now that you have copied the website files to your computer, the next step is to export the WordPress database. To do this, we’ll use phpMyAdmin.

Start by logging in to your cPanel and navigating to the Databases section. From there, select phpMyAdmin.

While there are alternative methods to access MySQL databases, this approach is the simplest for cPanel users.

After accessing the phpMyAdmin dashboard, locate and highlight the database you wish to export. Next, click on the Export button from the menu. Ensure that the export format is set to SQL.

Save the SQL file to your computer.

Now that we’ve downloaded all files for the old WordPress installation to the local computer, it’s time to transfer them to a new domain.

Firstly, you’ll need to configure your new domain to point to your web host. This involves updating the DNS settings for your domain to align with your web host. If you’re using the same domain registrar for your web hosting, you may not need to make any changes to the DNS settings.

Setting Up a New Database and Transferring Files to the New Host

After completing the first step, proceed to create a new database. This can be on the same web host where your old website was or on a completely different host.

Once the new database is set up, transfer the previously copied files from your local computer to the web host.

Create database on new host

To create a new empty database, access the cPanel dashboard and then navigate to Databases. Select My SQL Database Wizard.

Once prompted, provide a database name. Then click on the Next Step button to proceed to create a database user.

On the Create Database Users screen, provide a username and password. Note these details down somewhere as you’re going to need them soon when editing the wp-config.php file.

Proceed to step three of the database creation process, which involves adding the user you’ve just created in the previous step to the newly created database. Grant full user privileges, as illustrated in the image below:

Edit wp-config.php file

With a new MySQL database created on the new host, we have to edit the wp-config.php file with the new details.

Remember the WordPress files we copied to the computer? You might want to reach out for the wp-config.php file in that installation.

Use a code editor to open it and edit the values for DB_NAME, DB_USER, and DB_PASSWORD.

Fill in the database name, username, and password you created in the previous step and save the file.

All is now set to move the WordPress files to the new host.

Setup a new domain on your web host

There’s one more important step before we can move our WordPress files to the host: setting up the new domain hosting account.

This entails setting up a hosting account and then pointing DNS servers to it.

If you’re familiar with shared web hosting, most providers allow hosting of multiple domains on the same subscription account. So essentially you could be moving this WordPress installation from one domain to another on the same web hosting account, as was the case with my situation.

This entire process works just as effectively when moving WordPress to a different web host.

To set up a new domain, access cPanel and provide your domain name. Depending on your preference, you may opt to share the root document with other domains in your hosting account.

In this case, I’ll opt for /public_html/mydomain.

Once the domain is set up on the web host, ensure that the DNS servers are correctly configured as well.

Import database

We have a database file exported from the old WordPress installation. Let’s begin by importing that file into the new database.

To do this, return to the phpMyAdmin: from the cPanel dashboard, access phpMyAdmin under Databases and select the name of the database you previously created.

Once the correct database is selected, navigate to the Import button on the upper menu. Upload the SQL file that you exported earlier.

Ensure that all other settings remain at their default values, then click the “Import” button. Everything should proceed smoothly from there.

While still in the phpMyAdmin dashboard, click on the SQL button in the top menu. Here, we will execute a few SQL queries to update the wp_options, wp_posts, and wp_postmeta tables, editing URLs from the old domain to the new one.

The first query is this:

UPDATE wp_options SET option_value = replace(option_value, 'old URL', 'new URL') WHERE option_name = 'home' OR option_name = 'siteurl';

Replace ‘old URL’ and ‘new URL’ with the right values respectively.

Here are the other queries:

UPDATE wp_posts SET post_content = replace(post_content, 'old URL', 'new URL');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'old URL','new URL');

UPDATE wp_posts SET guid = REPLACE (guid, 'old URL', 'new URL');

You can run the queries all at the same time or you can run one at a time.

Migrate WordPress site to new domain

The final step is to copy files from computer to web host, this time into the root folder of the newly set up domain from the previous step.

To do this, launch FileZilla and establish a connection to your hosting account via FTP.

With the respective folders opened in FileZilla, highlight the WordPress files you wish to copy. Right-click while the files are selected and choose “Upload.”

Wait for the file transfer to complete, and then type the new domain into your browser to access your newly restored WordPress website. There might be some cleaning up to do.

Access your dashboard and navigate to the Permalinks settings. Simply click the “Save” button, and everything should be in order now.

And that’s it.

You should now have a fully restored WordPress website on a new domain, all without the need for a WordPress migration tool.

Do you know any other ways to transfer WordPress to a new host when you don’t have access to the WordPress dashboard?