7 Easy steps to Move a WordPress website to a new Domain!

As WordPress developers or designers we need to migrate or move our WordPress website from one server to another web server on regular basis.

If you have developed your WordPress website on a production server & now you need to move your website to a deployment server. You can migrate a website using a manual process or an Automatic process with the help of Plugins.

Manually Migrating a WordPress website is not that complicated if you follow simple steps. In this article, I’ll show the best way to migrate your website manually, step by step. We will also discuss which plugins you can use to migrate your WordPress website.

1. Take a Manual Backup of WordPress Files

The first thing you need to do is copy all your WordPress website files. To do this you’ll need FTP account details & FTP tool to download files from the server. If you don’t have any FTP tool, then you can use free tools such as FileZillaWinSCP for Windows-based systems or Cyberduck for mac.

Once you connect your website server via FTP you need to navigate to the root folder, which contains all files of your website. It’s usually called either public_html or www or is named after your site.

Now right-click the root folder & choose the download option.

This will start downloading files to your local computer. It will take some time to download all files.

Quick Hack

If your hosting provider has provided you cPanel account for your website hosting then I’ll tell you Quick Hack to take a backup of all files. It’s much faster than downloading files using FTP.

  1. Login to your cPanel Account
  2. Navigate to File Manager
  3. Now you will find folder name public_html or www or is named after your site.
  4. Right-click that folder & click on the Compress option.
  5. Select the compression option Zip Archive
  6. It’ll quickly create a zip file with folder_name.zip
  7. That’s it! Your file backup is ready to download.
File manager  - cPanel
File manager – cPanel
Select folder name public_html or www or is named after your site for compression.
Compress File in File Manager - Cpanel
Select Zip Archive option

2. Take a Backup of the WordPress Database

You should now back up the database. This is where you will find information about your site’s content, users, and much more.

You’ll need to access your database to complete this. Most web hosts provide this feature through your control panel. If you’re using cPanel, for example, you’ll find a Databases section. You’ll want to select the phpMyAdmin option in that section:

Quick Steps

  1. Navigate to the phpMyAdmin section in cPanel
  2. Select the Database of your website which you want to download
  3. Go to the Export option
  4. Select the Quick export method with SQL format & hit Go
  5. This will download a copy of your site’s database in .sql format.
phpMyAdmin Section

3. Create a new database

The next step is to create a new database on the web host you’re moving to. Then you’ll import the file from your previous database, which will overwrite the new one’s contents.

If your new WordPress host also uses cPanel, you’ll need to do the following:

  1. In cPanel, navigate to the Databases section and select MySQL Databases.
  2. From the same tab, create a new database and add a user to it (and take note of the names for later use).

4. Update new website details in the database & import SQL backup

If you are migrating your website from one hosting provider to another hosting provider while keeping the same domain name then you don’t have to any changes in the database.

But if you are moving your WordPress website to a new domain eg. Oldwebsite.com to Newwebsite.com. Usually, this happens when you are developing a website on a production server for testing & demo purposes. Once all changes are done you need to move the website to your actual domain name. Or in case you are completely rebranding & changing the domain name then you have to migrate the website.

So let’s check step by step how I do for my projects if I want to change the domain name while migrating the website,

Method 1

  1. Open your database .sql file in any text editor. I prefer Sublime Text it’s excellent (and free)
  2. With Ctrl + H or navigating through Find -> Replace at the bottom of the text editor new pan will open.
  3. In this pan, you can type Oldwebsite.com in the Find section & Newwebsite.com in Replace section.
  4. Now click on Replace All button & Save the file.
Search & Replace website Name

(Note: Take a backup of the .sql file before doing this step.)

Import Database

Now it’s time to import the database on a server.

  1. Access the new database using phpMyAdmin, as you did during step 2.
  2. Go to the Import tab within the new database, and upload the .sql file you updated earlier.

Method 2

  • Access the new database using phpMyAdmin, as you did during step 2.
  • Go to the Import tab within the new database, and upload the .sql file from your backup.
  • Once the database is successfully uploaded, select the database then run some SQL updates and replacement commands on the tables notably, wp_options, wp_posts, and wp_postmeta.
  • Use the code as below and swap in your old and new URLs, no trailing slashes. Also if necessary change the table prefix values where applicable (ie wp_ )
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

That’s it! Now your database is ready for the new website. In the next step, we will check how to upload website files to the new server. 

5. Upload all files to the new server/hosting

To upload all files to the new server you will need to connect the server via FTP same as we connected the old server in Step 1.

Right-click anywhere within that folder and choose Upload. Locate the folder you downloaded in the first step, open it, and select all of the files and directories contained within it.

Because we’re dealing with hundreds of files, the upload process may take some time. However, if you’re patient, you’ll soon find yourself almost at the end of the journey.

Quick Hack

  1. Do you remember we downloaded files in zip format? If you have downloaded files using FTP then try to zip all files. 
  2. If the zip file size is within the Max upload size then use File Manager to upload the file. Login to your cPanel Account
  3. Navigate to File Manager
  4. Now you will find folder name public_html or www or is named after your site.
  5. Click on the Upload option under File Manager
  6. Drop or Select files using file uploader to Upload
  7. Once a file is uploaded successfully you can unzip/ Extract the file.

6. Configure new details in wp-config

Now if as your all files are moved to the new server, a database is also uploaded with new domain name details. If you try to visit your website now it’ll not work because you need to update database details in wp-config.php. So that it’ll start using our updated database.

Let’s check how to update wp-config.php if you are using cPanel,

  1. Navigate to File Manager
  2. Now you will find folder name public_html or www or is named after your site.
  3. Try to locate the wp-config.php file right-click on it, and select the View/Edit option:

This will open the file using your local text editor, enabling you to make changes. Here are the three lines you’ll need to update:

define('DB_NAME, 'db_name');
define('DB_USER, 'db_user');
define('DB_PASSWORD, 'db_pass');

Currently, all three lines will contain values pointing to your old database. Replace the lowercase variables with the credentials for the new database that you created in Step 3.

Now add the following lines (replacing NewWebsite.com with the new domain).

define('WP_SITEURL', 'https://www.NewWebsite.com');
define('WP_HOME', 'https://www.NewWebsite.com');

Then save and close the file with your changes. You should now be able to access your WordPress website, which should look the same as before.

7. Final Check & Most common errors after Migrating the website

Everything should now be accessible on the new website; however, you should double-check to ensure that all of your settings are correct.

  1. If you use a caching plugin or system, make sure to delete all of the old data.
  2. Install the Search and Replace plugin, do a search and replace your old domain name with your new domain name.
  3. Set up a redirect on your old site using your preferred tool, so that all requests to your old domain result in a 301 redirect to (the same page on) the new domain. This should be thoroughly tested!
  4. Check Permalink Settings under the Setting option in the WordPress Admin panel. This is a very common error after migrating the website to a new server. At a first, glance if you check your website homepage you will feel that website is working fine but if you click on any internal page link it’ll show a blank page or a 500 error. To avoid such issues you should first check Permalink Settings & update it as per the old website.

Website migration is a time-consuming task, but moving your WordPress site to a new host doesn’t have to be difficult.

That should do it; you’ve successfully transferred WordPress to a new domain. If you have any suggestions or notice any errors, please leave them in the comments!

Need Migration Help?

If you need any help migrating your WordPress to a new server or domain then you can take the help of our professional team. Our team will plan the seamless migration of your WordPress website without losing any crucial data & minimal downtime. Click here to book a call with our WordPress expert.

Leave a Comment

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

Scroll to Top