Tech Zone

How to transfer WordPress site from one host to another?

4 Mins read

Today, WordPress has become the most popular Content Management System (CMS) in the world. It is used by more than 74 million sites to publish new content every second. It was first set up mainly for bloggers and now it is used to build website of any size. There are a number of Web hosting providers to host your WordPress site/blog. Many of them offer free WordPress hosting services also. Choosing the best can improve your SEO and increase your sales.

“Acronis is directly responsible for saving our company 1200 hours per year for IT operations staff in backup and recovery workflows.” CIO, high performance IT company.
Read details in a report by Forrester.

WordPress – a quick introduction:

As per wiki, “WordPress is a free and open-source content management system (CMS) based on PHP and MySQL”.

There are a number of reasons why WordPress is ideal CMS for your business website. It is:

  • Free
  • Flexible
  • Open source
  • Safe and secure
  • Customizable
  • Easy to use and manage

It can be easily installed on a web server which can be a part of an internet hosting service or may be the host itself. And when you move it to a new server or to a different location on your server, you don’t need to reinstall it. WordPress is flexible enough to handle all these situations.

In this blog, we will discuss, how to migrate your wordpress website from one hosting server to another server.

Managed Alibaba Cloud

Cheaper, Faster & Secure Cloud Hosting

Steps to transfer your WordPress website from one host’s server to another:

If you are moving your WordPress site from one server to another, begin by backing up your WordPress directory, plugins, and other files on your site as well as the database.

Step 1: Back up your website’s files

It is the basic requirement of migrating your WordPress installation.

If your website content is in public_html (in case of cPanel) or if WordPress is installed in any sub-domain, you have to take backup with zip or you can also copy all contents via FTP (Filezilla) to your local system.

Refer the screenshot. In this case, our data is in ‘wp’ folder:

backup-website

After completing this, a zip file will be generated in the same directory. We can also download this backup on our local system.

Step 2: Backup your databases

As we are all aware that the database is the heart of WordPress and without database, we can’t use it. We can take the database backup from “php myadmin” or from shell access.

For this, we have to log into cPanel and then go to ‘php myadmin’. Select the database and click on ‘Export’.

backup-database

Choose the format as “SQL” and generate the database backup.

database-bckup-sql

Now a popup will show to download this backup in .SQL format.

#for taking backup from shell:

  • mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` database > database.sql//for plesk
  • mysqldump database_name > database.sql //for cpanel

The data content and database backup have been completed.

Step 3: Prepare for migrating all data and databases to new server

Now it’s time to move or migrate all data to the new server.

  • Upload all the data content in the public_html or in sub-folder where you have WordPress. You can upload the data via FTP or you can upload the data backup in the directory and extract it.
  • Now, we will import the database backup for this:
    • Create a database and database user and assign all privileges to the same.
    • Please make sure that the prefix of database must be same as was there in the old server. It would be helpful to export the database easily or without any error.
  • After creating the database, open the “php-myadmin” and click on ‘Import’.
database-new-server

Now select the backup file from your local system and click on ‘Go’.

server2

We can also restore database backup from shell:

  • mysql -uadmin -p`cat /etc/psa/.psa.shadow` database_name < database.sql //Plesk
  • mysql database < database.sql //cPanel

We have migrated all the data content and databases to a new server. Now, we will do some required changes to make this migration complete.

Step 4: Edit the wp-config.php file

wp-config.php controls the access between WordPress and your database.

If the database and database user name is same as was there in the old server, there is no need to update the wp-config file.

Else, we will change the following details in wp-config file:

  • define (‘DB_NAME’, ‘write the database_name here’);
  • define (‘DB_USER’, ‘write the database_user_name here’);
  • define (‘DB_PASSWORD’, ‘write the DB_password here’);

Step 5: Redirection setup

To transfer your old domain’s SEO to the new one, it’s important that you set up a 301 redirect as follows:

You can use default .htaccess WordPress file:

# BEGIN WordPress

IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
/IfModule

# END WordPress

To update your permalinks, go to Settings > Permalinks, select the permalinks structure which you want and Save Changes.

Some Useful Tips:

  • Caching Plugins: Some caching plugins may modify your .htaccess or create a new .htaccess file to absolute paths that may not exist on your new hosting setup.
  • Google reCaptcha Plugin: If you have any Google reCaptcha plugins installed, get the new API key for your domain, so that you will not find any difficulty in displaying the reCaptcha.
    Now, we have successfully completed the migration.
“Before the Acronis implementation, there was a huge risk that malware could take down our company. Now, with Acronis, I can say that we’ve done everything possible to protect our data from an attack.” CIO, high performance manufacturing company.
Read details in a report by IDC.

Feel free to ask any question regarding this through the comment section below.

Services ZNetLive offer:

Domain Name Search

Buy Shared Hosting

Managed WordPress Hosting Plans

Buy VPS Hosting

Dedicated Server Rental

3 posts

About author
Deepak Yogi, a Linux System Administrator, is an enthusiastic technologist. An engineering graduate, he enjoys cricket and spends his free time with his family. Deepak believes in sharing knowledge to make this world a better place.
Articles
Related posts
Cloud HostingTech Zone

What is Akamai Connected Cloud? Explained in Detail.

4 Mins read
In recent years, cloud computing has grown significantly, becoming a key component of the infrastructure for modern business and technology initiatives. Its…
Cloud HostingNetwork-as-a-ServiceTech Zone

The role of networking in cloud computing

4 Mins read
Cloud computing has completely revolutionized the way modern businesses operate – by offering agile, scalable, and cost-effective access to resources on demand….
Tech Zone

Top 5 electronic signature apps to sign documents online in 2024

5 Mins read
In a world where everything from your memories to your money can be digitized, it is no surprise that electronic signatures are…

1 Comment