Transferring your WordPress site from your existing hosting provider over to Hetzner WordPress hosting need not be a difficult or complex task. Below is a step-by-step guide to help you.
Alternatively, there are a number of plugins that may be able to do the job for you. If there is an error, though, it may not be clear where the problem lies.
Download Existing Site
First you need to download your existing site from your current hosting provider to your computer in order to upload it again to Hetzner.
There are 2 components of a WordPress site that need to be downloaded:
- Files: This includes the core WordPress files, any installed themes and plugins. Also, any other documents you may have uploaded to the site, including images, PDF files etc.
- Database: The database contains all your posts, pages and other settings for WordPress
You’ll need to download both the files and the database in order to have a complete copy of your WordPress site.
Downloading the Files
Using an FTP program (such as FileZilla), connect to your site and browse to the root of your website. In your FTP program you should see files and folders similar to the following:
Select all the files and folders (excluding any non-WordPress files and folders) and download them to a folder on your computer. You can do this either by dragging-and-dropping the files, or clicking on the download button in your FTP client.
Note: Depending on the size of your WordPress site, this process could take a while (up to a few hours). If the process fails, it’s best to start again with all the files.
Downloading the Database
Your existing hosting provider should provide you access to your WordPress database via a tool called phpMyAdmin. This can be accessed via the control panel (such as Cpanel).
Once logged in (you may need to provide a username and password) follow these steps to download the database:
- Select the database used by your WordPress site, by clicking on the link in the left hand panel.
- Click on the Export tab on the right hand side
- Leave the Export Method option set to Quick
- Set the Format to SQL
- Click Go
This will download a file to your computer. If it’s not already, move it to the folder you set up on your computer earlier.
Set up New Database
Your new WordPress site will need a database on the new site. Follow these instructions on how to set up your database via konsoleH.
Once you have set up the new database, record the login credentials, database name and host, as you will need these details later.
Edit Local Config File
Before you upload your website files to the new site, you must edit the WordPress config file (wp-config.php) you downloaded earlier.
Browse to your download folder and locate the file, wp-config.php. Open this file using a text editor (such as Notepad on Windows or TextEdit on Mac). Because this is a copy of the file that is currently uploaded to your live site, it’s not necessary to make a backup before you edit this file.
You need to find the database details in the config file and replace them with details of your new database.
Replace the text in italics below with the corresponding values from your new database.
We’ve create the following table to help you find the relevant info required in the wp-config.php file into konsoleH.
Upload Existing Site
Uploading the Files
At this point you can start the uploading of your files to new website, by following these steps:
- Using your FTP program, connect this time to your domain hosted with Hetzner by using either your domain’s Hetzner hosted server name or IP address.
- Browse to the public_html folder.
- Upload all the files from your local folder to the public_html folder
This process can take a long time to complete – up to a few hours depending on the size of your website. If it fails, it’s best to upload all the files from scratch again. If you are not able to upload your files after a number of attempts you can contact our Support Team for assistance. Please provide our consultants with details of the error that you are currently experiencing to enable us to assist you.
Uploading the Database
You can upload your database using phpMyAdmin from within konsoleH. Step-by-step visual instructions are available here.
- Log in into konsoleH
- Click on the website name under the Hosting Services tab
- Click Manage Services in the left hand menu
- Click on Databases > Manage MySQL
- Select the database you created early, by clicking on the checkbox
- Click on phpMyAdmin in the top right
phpMyAdmin will now open in a new window. Now upload the database via phpMyAdmin:
- Click the Import tab
- Under the File to Import heading, click the button next to the Browse your computer label
- Browse to the location of the database file which you downloaded and click to select the file.
- Make sure the drop-down box under the Format heading is set to SQL
- Click the Go button
If all goes well your database will be uploaded. If not contact our Support team at email@example.com
Find and Replace
If you are migrating your site over to a new domain name as well, then you will need to replace all references to the old domain with the new domain. The following section explains how to do this.
Note: Running a global search and replace on your website has its risks. Please only proceed if you are confident in your technical ability.
You may wish to consider a WordPress plugin to perform this function for you.
You will need to download a script that will search your entire website database and replace your old domain with the new one. You can download the script, here. Follow the instructions on this website to install the script on your website.
Once the script is installed, browse to the script folder using your web browser. You should see a page similar to this:
Fill out the fields as follows:
- Replace: Enter your new domain name here, for example: newdomain.co.za
- Search: Enter your old domain name here; olddomain.co.za
- Database: Enter your new database details here
- Click the Update Details button
- Click the Live Run button to start the search and replace process.
Once complete, all references to your old domain name should have been replaced with your new domain name.
Testing Your New Site
If you are only migrating the site over to Hetzner, while keeping the same domain name, we suggest that you test your new site before transferring your domain.
The easiest way to do this is by emulating the DNS change by updating the host file on your computer
- Find the IP address of the server your website is hosted on.
- Update your host file. Your host file could be in various locations based on your operating system:
In Windows, the file is located in the following folder:
On Mac, the file is located here:
- Edit this file using a text editor (with Administrative privileges). Once opened, add the following to the bottom of the file:The IP address of your server, followed by a tab and then the domain name of your website e.g:
- Save the file and browse to your domain name; you should see your WordPress site as hosted on Hetzner.
The final step in this process is to transfer your domain name to Hetzner. This will ensure that when your visitors browse to your domain name they will see your website as hosted with Hetzner. Have a look at one of our comprehensive guides on transferring your domain to Hetzner.