Home » Blog » WordPress Tips » How to Copy a WordPress Site From One Domain to Another Manually

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

When it’s time to move your WordPress site to a new domain, the go-to method is usually a migration plugin. But what if you can’t access your WordPress dashboard? Maybe your domain expired, and you missed the renewal deadline. Even if your web hosting is still active, you could find yourself locked out. In such cases, you need to roll up your sleeves and manually move your WordPress site to a new domain via FTP.

Don’t worry, though. In this guide, we’ll walk you through a reliable, step-by-step method to manually migrate your WordPress site from one domain to another.

Step 1: Prepare for the Migration

 1.1 Backup Your WordPress Site

Before you proceed to export your WordPress site, create a backup. It’s the golden rule of moving a WordPress site. Even with the best migration tools, things can go wrong. So, make sure you have a copy of your website files safely stored.

You’ve got a few options here: use your hosting provider’s backup tool (most hosts offer one) or manually back up your site via cPanel or FTP.

1.2 Check New Domain and Hosting Requirements

With your site backed up, it’s time to set up your new domain and hosting. First, ensure your new domain is registered and your hosting plan is active. There are plenty of domain registrars out there, so pick your favorite and get your new hosting plan.

If your domain registrar also handles your web hosting, the DNS settings are usually configured automatically. If not, you’ll need to manually set your DNS settings to point your domain to your host. And don’t forget, make sure your new host is WordPress-friendly.

You may also just set up a new domain on your current hosting. The process works just as when moving 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, the folder is /public_html/mydomain.

Step 2: Export Your WordPress Site

This 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.

 2.1 Download WordPress Files from Web server to Local Computer

For this step, you can use 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

2.2 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.

Note: You should already have your new domain and web host setup, as in Step 1.

Step 3: Set Up a New Database and Transfer Files to the New Domain

With the previous steps completed, we have all our website files that we need to move to the new domain safely downloaded to our local computer.

Now 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.

3.1 Create a New Database

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:

3.2 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.

3.3 Import the Database and Update URLs

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.

Step 4: Migrate WordPress Site to New Domain

The final step in moving a WordPress site to a new domain 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.

Clean Up Process

Once all the file transfers are complete, it’s time for some housekeeping:

Check for Hardcoded URLs

Identify and update any hardcoded URLs in your theme files, widgets, and content. Tools like Better Search Replace can make this process efficient and painless.

Test the New Site

Verify that everything on your new site works correctly. Look for broken links, missing images, and any other issues. Don’t forget to access your dashboard and navigate to the Permalinks settings. Just click the “Save” button to refresh the permalink structure.

Submit New Domain Sitemap to Search Engines

Generate a new sitemap and submit it to Google Search Console and other search engines. This helps ensure your new domain gets indexed properly.

Do you have any other tips for transferring a WordPress site to a new host when you can’t access the WordPress dashboard?

Share your love
SEO for Geeks
SEO for Geeks

We're a dynamic duo of web dev and SEO nerds with expertise in WordPress, web development, and writing.

Articles: 25

Leave a Reply

Your email address will not be published. Required fields are marked *