How to move WordPress to a new Host
This could be considered to be shooting one’s self in the foot, as we’ve gained hundreds of clients over the years because there wasn’t clear instructions in a step by step format to move WordPress from one server, to another properly without the usage of backup plugins. Although backup plugins may suit some people to me they are a complete nightmare, businesses rely on these plugins without checking the backups on a regular basis, only to find out that the backups are corrupt or never actually worked in the first place. Following the instructions in this “how to” will teach you how to save your site and database to your computer ( for safe keeping ) and reupload the files and database to your new host.
Before initiating the migration process, it is crucial to prepare adequately. The following checklist serves as a preparatory guide:
- Backup Current Website: Ensure you have a complete backup of your website, including all files and databases.
- Check Compatibility: Verify that the new hosting environment meets your website’s technical requirements.
- Inventory of Assets: Enumerate all plugins, themes, and custom code changes.
- Downtime Planning: Plan the migration during hours that will have the least impact on your audience.
Common Pitfalls and How to Avoid Them
Even with meticulous planning, certain issues can arise during the migration process. Awareness of these pitfalls can facilitate a more seamless transition.
- Database Import Errors: Should the database fail to import correctly, consult your hosting provider for assistance.
- File Permission Issues: Incorrect file permissions can lead to various issues. Consult the WordPress file permissions guidelines for proper settings.
- Broken Links: Utilise tools like Broken Link Checker to identify and fix any broken links.
- SEO Concerns: Use SEO tools like Ahrefs to monitor your website’s performance and make any necessary adjustments.
After successfully migrating your website, several steps should be taken to ensure optimal functionality.
- Check Website Functionality: Navigate through your website to confirm that all features are operational.
- Update DNS Settings: Update your Domain Name System (DNS) settings to point to the new server. Consult your hosting provider for specific instructions.
- Monitor Website Performance: Employ monitoring tools such as Pingdom to keep track of website speed and uptime.
- Test Interactive Elements: Verify that all forms, buttons, and e-commerce functionalities are in working order.
1. Backup and Download your site files.
I always recommend using an FTP client over a host provided web based file editor. There are some great FTP programs out there that allow you to upload and download files to your server/host. One of my favourites is Filezilla which can be downloaded here : https://filezilla-project.org/download.php
Once you have opened your FTP client, entered your server/host details and have found your WordPress install, it should look similar to this :
Everything in the above folder ( the main WordPress root folder that contains folders such as wp-admin, wp-content ) you need to download to your computer, often easy to create an empty folder on your computer and put all the files into that folder, you should also have your new server/host setup and the new FTP open ready to use. You may now upload all of the files you just downloaded to your new host.
Now all the files are download and uploaded, its time to get your database from the old host/server. We like to do this manually again rather than using any plugin.
2. Export your database from phpmyadmin
(We use cpanel with the images captured below, but if your host uses something different you may need to locate things slightly differently to the images outlined )
Login to your hosts cpanel account, normally accessed via browsing to your domain such as ( yourdomain.com/cpanel )
You next click phpMyAdmin, you will then be presented with a column on the much like below, you need to click on the database which your wordpress install is using, for us this is rivmedia_2017.
Once clicked you should see the expanded database tables, this contains all of your wordpress data, from core to plugins.
Now in the right hand window you will see some navigational items, one of those is “export”
Once one the export page, press “Custom – display all possible options”
Then make sure all tables are ticked for export :
Now scroll down the page slightly and find the “compression” tab, if you have a large database its a good idea to use the compression because your new host may have a limit on SQL uploading.
Now your ready to export your database, press the “go” button at the bottom, depending on your server / host it may take a moment to process, you will then be prompted to “save” the file to your computer.
3. Create new database on your new server.
You now have all the data you need from your old host/server. You can save all the files you downloaded from FTP and the database you just downloaded for long term storage as a backup if you need to ( its always good to keep historical backups ). Now lets move on to uploading to your new server.
Login to your new server/host’s control panel. The first step is to create a new database that will be used for your new WordPress Blog.
Click on “MySQL Databases”.
Under “Create New Database”, enter a name for your new WordPress database, then click the “Create Database” button.
Once the database has been created ( should take seconds ), we need to add a user to that database with the correct permissions. This is normally on the same screen, but further down.
Enter a name and password for the WordPress database user and click the “Create User” button.
Now you have to give the user you have just created permission to use your WordPress database. So on the same screen again, you will have the options given in the screenshot below. Select your user that you’ve just created, and the database and click add. Take a note of the database name, user ( including the prefix ) and password as you will need these later.
On the next screen, you have the option to grant which permissions this user has to your blog’s database. Be sure to grant this user total access to the WordPress database by checking “All Privileges”, then click the “Make Changes” button.
4. Import your previously saved database
Now its time to go and locate the compressed database you downloaded from the old server, because we are going to import it to the new database and user that we’ve just created.
So back to the main cPanel screen click on “phpMyAdmin”.
In the drop-down box in the left column, select your new WordPress database that you’ve just created. It should say that there are no tables in the database yet, since it’s a blank database that you’ve just created.
Click the “Import” tab in the navigation. Below you will see a “Browse” button and select the .sql or .sql.gz file that you downloaded from your old WordPress database, then click the “Go” button.
This part can take some time depending on the size of your database, after waiting for the WordPress database to import, you should get a green notice saying that your database import has competed.
Using a different domain than the original ?
If you have moved domains as well as hosts, then there are some additional changes you need to make otherwise you will continuously get redirect loops when trying to access the site. We need to modify a couple of values. Still in phpmyadmin, and still looking at your database tables. You now need to find the “options table” ( wp_options )
After you click the wp_options table you will find yourself landed on the “browse” tab, scrolling down you will see an option for “siteurl” under the “options_name” column. You will see your old WordPress URL in that field. If your new WordPress blog is on a new domain name, you need to edit that value to your new domain name, If the domain name is the same then you can skip these sections until the final point.
You can do so by clicking the “Edit” button, which looks like a pencil.
Once you click the “Edit” button, just enter your new WordPress domain and then click the “Go” button to save the changes.
You now need to repeat that same process for a different field, so head back to the “browse” tab, now look for the field “home” instead of “siteurl”, this is sometimes located on page two of the options, You can change the page numbers at the bottom of the options table list. Repeat the same process above, changing your URL to the new domain. Click Go.
5. Database work complete – Final Point
Now the last thing todo is to edit your wp-config.php file which you previously uploaded to the new host. This is in the root folder of your WordPress blog (usually /home/ or /public_html/). You can do this with your FTP client you’ve used previously.
Find the file “wp-config.php” , open the file in a plain text editor or something like Dreamweaver, notepad++ or similar.
Once the the wp-config.php is open you will see something a little like the image below. Half way through I asked you to take a note of the database credentials that you created for the new database/user, you now need to use those details to make the connection from the files, to the database.
DB_NAME, DB_USER, and DB_PASSWORD.
Make sure you keep your details inbetween the ‘ ‘ brackets.
This IS NOT your WordPress admin username and password! This is your database’s name and password which you just created for your new host/server.
Save your changes, Reupload the wp-config.php to your new server overwriting the one that is currently uploaded.
6. Thats it !
Congratulations, you’ve just learnt how to manually back up a WordPress site, download it to your local computer and reupload and install it to a new server or host. If you found any of this tutorial useful, please like, share and tweet it so it helps others too.
Now head over to your domain and login to the admin panel, we’ve customised our WordPress login below, but you should know what the WordPress login looks like by now 🙂 (i.e. example.com/wp-admin). Your admin logins will be the same as they we’re previously on your old WordPress blog.
Troubleshooting Common Errors
Encountering errors during or after migration is not uncommon. Here are some typical issues and their solutions:
- White Screen of Death: This usually occurs due to a theme or plugin conflict. Deactivate all plugins and themes to identify the culprit.
- 404 Errors: If you encounter 404 errors, try resetting your WordPress permalinks. Navigate to Settings > Permalinks in your WordPress dashboard and simply click “Save Changes”.
- Database Connection Errors: Double-check your
wp-config.phpfile to ensure that the database details are correct.
Security should be a top priority when migrating your WordPress site. Here are some measures to consider:
- SSL Certificates: Ensure that SSL is configured for your new host. Most hosting providers offer free Let’s Encrypt SSL certificates.
- Firewalls: Implement a web application firewall (WAF) for added security. Solutions like Cloudflare offer robust WAF services.
Optimising your website’s performance is crucial for both user experience and SEO. Here are some tips:
- Caching: Implement caching solutions like W3 Total Cache, WP-Rocket or Litespeed cache to speed up your site.
- CDN Integration: Use a Content Delivery Network (CDN) to distribute the load, saving bandwidth and speeding up access for your users.
- Image Optimisation: Use image optimisation plugins like Smush to reduce file sizes.
Backup and Recovery
Regular backups are essential for disaster recovery. Here are some backup solutions and tips:
- Automated Backups: Use plugins like UpdraftPlus to set up automated backups.
- Off-site Backups: Store your backups in a secure, off-site location such as cloud storage services like Amazon S3.
Updating Local Development Environments
If you maintain a local development environment, ensure it mirrors your new live environment. Update the local database and file structure to match the live site.
Legal and Compliance
When moving to a new host, especially one in a different jurisdiction, be aware of legal and compliance issues such as GDPR. Consult legal advice for compliance with data protection and privacy laws.
If you are still struggling with anything mentioned here, or any other WordPress related problem, feel free to get in touch about our WordPress services or Cpanel Services