Table of Contents Hide
- Step 1: Backup your website files
- Step 2: Export the WordPress Database
- Step 3: Create a WordPress database on your New Hosting Server
- Step 4: Edit the wp-config.php file
- Step 5: Import Your Database
- Step 6: Upload the WordPress Files to Your New Hosting
- Step 7: Define New Domain & Find / Replace Old Domain
- Step 8: The Final Step
Moving or migrating your WordPress website from old to new hosting can be a daunting and stressful job, because the process of migrating a WordPress website is sometimes not as smooth as we would like. But as long as you have the correct backups then you shouldn’t be afraid to do the WordPress migration process itself.
Many website owners are faced with the need to move to a new hosting for some reason such as there is a problem with the hosting provider they are currently using and then they feel they have to migrate to a new hosting place that suits them. However, it would be nice if before buying hosting, you really saw and researched the hosting company so that you don’t get disappointed in the future. Here I have summarized a list of the best hosting in Indonesia and the best hosting in the world .
However, if you are currently experiencing problems with your old hosting, I still recommend that you immediately move hosting or migrate hosting to a new, more promising place for your website.
To solve this problem, you can either pay a professional to move your website to a new hosting, or find a new host that offers free services for hosting migration, and most of the best hosting providers in Indonesia also provide services for hosting migration for free. If you want to have your own hosting experience, you can take the third option, which is to try to migrate your own hosting by following the WordPress migration method which I will explain below.
If you’re willing to spend a little time setting up your website yourself, hosting migration isn’t something you need to worry about. This can be a very easy project if done right and can easily be undone if a problem occurs.
Let’s go through the steps on how to migrate your WordPress to a new host, but before I start showing you how you can migrate your WordPress website, please keep in mind that many of the best WordPress hosting companies are willing to move your site from old to new hosting on an ongoing basis. It’s free for you, so if you’ve recently purchased a new hosting plan and want to move your site, ask support if they’d like to help you with the free WordPress migration process.
Step 1: Backup your website files
The first step that you should take is to create a WordPress backup or backup every aspect of your WordPress website. A backup is something you should do before making any major changes but is also a mandatory requirement before migrating your WordPress installation.
There are many plugins that you can use to back up your website. However, the backup here requires a manual backup method. You can use an FTP client program (such as Transmit, Filezilla), connect the FTP software that you have installed on your computer, then connect to your web hosting and copy all the files under your website directory to a folder on your local machine.
This includes .htaccess files which are usually set to be hidden. You can use to unhide the file with the help of your FTP program if you cannot see this .htaccess file.
This backup process can take a long time or may be very fast, depending on the amount of image media or other media you have on your website. While waiting for your WordPress website files to download which is currently in progress, you can initiate step two and create a copy of your database.
Step 2: Export the WordPress Database
Exporting your database is a simple process that takes only a few steps to complete. Login to the cPanel account of your web server and open the phpMyAdmin application. Select the database containing your WordPress installation from the list on the left sidebar and once selected click on the Export tab in the navigation menu.
Default setting “Quick export” and SQL format for export is sufficient and you do not need to change. Click the “Go” button and the database export process will start and a file will be downloaded to your local computer.
After the database export and FTP transfer of your files are complete, you are ready to move to the next step.
Step 3: Create a WordPress database on your New Hosting Server
Before you can start migrating to a new web hosting, you will need to create an environment for your WordPress installation. To do this, you will need to create a new database to import your SQL database from.
Log in to your new web hosting with the user login account they have provided you with and log into your cPanel. For this guide, I will be using the MySQL Databases application. If your web host does not run this application then you will need to contact their support team to find out their method of creating a new database. If it supports then you are in luck and can continue using the method below.
The steps for creating a database are quite simple:
- Open MySQL Database and create a new database with a suitable name for your website.
- Create a new MySQL user (with secure password).
- Add this user account to the new database and grant it All Privileges.
Enter the database name, new MySQL username and password. You will need it right away.
Step 4: Edit the wp-config.php file
Open it and find the folder on your local computer where you downloaded your WordPress website files. In that folder there is a file called wp-config.php which controls access between WordPress and your database.
Make a copy of this file and save it in another folder on your local machine. This is needed as a backup in case something goes wrong.
Open the original version of the file with your favorite text editor and make the following three changes:
1. Change the name of the database
Find the following line:
define ('DB_NAME', 'db_name');
db_name part of this line is currently configured with your old web host’s MySQL database name. This should be changed to the name of the new database you just created.
2. Change the database user name
Below you will find the line:
define ('DB_USER', 'db_user');
In this line you need to change the
db_user part of your old hosting username to match the new username you just created.
3. Change the Database User Password
Finally, edit the third line:
define ('DB_PASSWORD', 'db_pass');
Like everything else, the
db_pass section on this line should be changed to the new secure password you created for your MySQL user.
Save wp-config.php and close the file.
Step 5: Import Your Database
Now that you have a new database you are setting up on the new hosting. You can start the import process.
Open the phpMyAdmin application on your new cPanel server and select your new database from the list on the left sidebar. Once open select the “Import” tab from the navigation menu.
In the File to Import section, click the “Choose File” button and select the SQL file you exported earlier on your local computer.
Uncheck the “Partial Import” box, make sure the format is set to SQL and then click the Go button. The database import will now begin.
This import time varies depending on how large your database is. If you have received a message informing you of the successful completion of the import. Then the process has been successful.
Step 6: Upload the WordPress Files to Your New Hosting
Now that you have setup a new database and have reconfigured the wp-config.php file, it is time to start uploading or uploading your WordPress website files.
Connect the FTP software to your new web hosting and browse to the folder that will be used to house all of your WordPress folders and files. If this is the only website you will upload under your new hosting, then upload the files to the
public_html folder, this is the folder that is commonly used.
Wait for your WordPress file upload process to finish, this will also take approximately the same time as when the download process.
After the upload process is complete, do not delete this file from your local machine. They are still needed until the final steps have been completed and your website is completely accessible. If you can, you should keep it as a backup file for the long term.
Step 7: Define New Domain & Find / Replace Old Domain
If you are also moving to a new / different domain then you should read this step, if not then you can skip this step as you don’t have to update your site to point to a different domain.
One problem that most people seem to always have when moving their site is that they have added a link to another post on their site or inserted an image directly by pointing to a URL on the server, and this caused problems when moving to a new domain. If you want to quickly and easily find samples of your old domain name and replace it with a new name, I recommend you to use the “ Better Search & Replace ” plugin. This will allow you to make URL changes to new domains in posts and all very easily.
Changing Site URL : By doing a search and replacing for the old domain and replacing with the new domain you will also change the
site_url value and the home URL in the database (Change Site URL) which will ensure that when you try to log in to your site on the new domain it doesn’t try and redirects you to the old domain.
Step 8: The Final Step
This last step of how to migrate WordPress to new hosting actually covers two separate things.
Before you can use the website on your new host, you will need to reconfigure your domain’s DNS settings. The domain is set up and points to your old host and you will need to point the DNS domain to the new server IP address.
This process will depend on where you registered your domain. The details for completing this process are too diverse to cover in this post, but the place you list your domains should have all the details you need to make this change.
DNS changes typically take up to 48 hours to fully lead to your new hosting. It’s a good idea to do this process when your website usually gets low traffic levels, 10pm or above 12pm.
And during this 48 hour lag, you should not make any changes to your website as there is a possibility that you may have made changes to an older version of your website.
After the 48 hour period has ended, you will now need to access the new web hosting when visiting your website. At this point you can connect to the old web hosting to delete your files and databases.
And remember, you should still have a local backup copy of your WordPress site files as well as your database, as well as your original
wp-config.php As I have reminded you above, that you should keep these files for a long period of time to be safe.
When you read and understand the steps for WordPress migration above, the process isn’t difficult. What you really have to pay attention to is that you are careful every step of the way and always make safe backups for you in case something goes wrong.
However, if you are unsure which migration process to do yourself, be sure to always ask the support department of your new host for assistance. Usually they can do it faster and safer. But if you want to learn how to personally migrate WordPress to new hosting, then please follow the steps above carefully. Good luck 🙂