How to Migrate a WordPress Website?

WordPress is built as an open-source, totally free web design and content management solution. As such, they make it really easy for you to move it to a new server or simply to a new location on an existing server. WordPress themselves don’t make money by keeping you on the same server, so they put the customer first and make it easy for you to move around. 

The process of migrating a WordPress website from one server to another is quite simple. We’ll walk you through the process in this post. Know that you want to move your WordPress site, but aren’t sure where you’ll be moving? Check out our hosting comparison tool to make sure you land in the right spot. Even if you think you’ve found the perfect landing spot for your WordPress site, you can still see how it stacks up against other hosting providers!

How to Migrate Your WordPress Site

1. Begin With a Backup

While WordPress has made it pretty easy to jump your data around from place to place, there are still times where something gets lost in translation or the data goes a bit funky. You should always backup your WordPress site and make sure you’ve got the backup stored in a secure location before you start moving things. It’s always best to have extra versions of your site to delete, rather than finding that you’ve lost all the recent extant versions of your site.

2. Exporting the Database and Files

Next, you’ll need to export your database by going to the control panel of your old web host. Open the phpMyAdmin app in order to see the database. Select the WordPress database and click export from the menu. The default settings will be fine.

Next, do a simple FTP transfer or your old files.

3. Putting WordPress on the New Host Server

Login to your new web hosting solution and open up the control panel. You should have a MySQL Databases app somewhere in the control panel, where you can create a new database and a new user. You should grant the database all privileges with the new user.

4. Editing the wp-config.php File

Navigate into your wp-config.php file. You will have to change the values for your DB_NAME, DB_USER, and DB_PASSWORD so that they reflect the values of the new host server that you’ve created.

5. Import the New Database and Upload WP Files

Now open up the control panel of the new web hosting solution and open the file importer. Select the SQL file that you have already imported and import it into the database. This can take awhile. Additionally, make sure that you’ve unchecked the partial import option and make sure that the file import format is SQL.

Next, from the FTP program, select the new website folder that you’re going to be putting things into. Use this directory to put in the WordPress files that you scraped from the old site, and additionally you’ll put in the updated version of the wp-config.php file.

Migration and Domain Names

Once you’ve put in the new database and new WP files, you might be up and running and good to go. If not, you’ll need to check out the part below about changing domain names and URLs.

How to Move Without Changing Domain Names and URLs

Because most hosting companies really, really want you to move onto their servers and pay them, most hosting companies make it easy to move your site and keep your domain name and URLs intact along the way. For the most part, you won’t even have to do anything to prevent the domain name or URLs from changing. If the database and the URL of the main site are the same, then just copy the files and database and move everything over. 

If the database name, password, or the user is different, then you’ll have to edit the wp-config.php to make sure that the values are correct. If the values are changed but you change them in the wp-config.php, then the domain name and URL will remain the same. 

If you’re worried about domain names, domain authority, and broken links–there is a way to test things before you completely switch over. You can go to the database table and change the home and siteurl values in the database table. Go to wp_options through your phpMyAdmin and make the switch. If there are permalinks setup on your site you must reconfigure the permalinks once you’ve put the site on the new destination. 

How to Move and Change Your Domain Name and URLs

If you want to migrate your site to new servers and also change the domain names and URLs, then you’ll need a simple procedure. Simply download the files of your site as they are now and export your database from within MySQL. Now move the files and database into a new safe folder that is somewhere out of the way, that way you don’t lose any data! If anything goes wrong in the next part you’ve still got your files.

Login to the site and navigate to the general settings tab. Change all the URLs to the new destination name. For example, you could change things from “http://mysite.com” to something like “http://myothersite.com” or something like that. Now you’ll get a 404 destination not found page if you try to load the site. 

Next, download all your files and export the database once again. Now navigate into the wp-config.php and edit the database with the new server’s database name, user, and password. Now you can safely upload new files and import the new database onto the new server. Your site should be uploaded successfully with a changed URL and domain name! If things don’t go as planned, remember that the first step was to create an additional backup in case anything goes wrong. 

Remember that changing your domain and URLs can have additional problems, because the references to the old domain and location can still be in the database. You may have to find and replace all instances and references to the old site location in your database to clear everything from this. 

Additionally, there are some kinds of themes and widgets that store the length of the URL, which can break the whole site when you switch the location. If you have the “Better Search Replace” plugin or something similar, you can use the plugin to shift all the URL references to avoid breaking the site. Alternatively, you could use the search and replace function within WP-CLI if you or your hosting provider have installed it, or the search and replace WordPress Database script if you need something to change.

What About Losing SEO?

One of the issues of moving your WordPress site or changing anything related to links, domain names, and URLs is that you might lose some of the valuable search engine optimization that you’ve done. Shifting even the way that your site is laid out can change the way that crawlers interpret your data which can cause you to drop in the rankings. Especially if you’ve spend months honing in your SEO to a knife’s edge, then you don’t want to lose all of that optimization.

Additionally, if your site goes down for too long or looks a lot different, you can lose your search rankings because Google won’t see it as the same thing anymore. Get around this issue by using the right kind of plugin. For example, if you’re worried about losing SEO when things change, you could install the free Duplicator plugin. The Duplicator plugin can move your website to a completely new domain name while allowing you to retain the SEO that you’ve done on the site. Once you’ve installed Duplicator, navigate to packages in the WordPress admin area. Click create new and then next to start your package. The plugin will then scan your site to make sure that you’re ready to safely duplicate everything. As long as the scan comes back with all the metrics reading “good,” then you’re ready to click the build button and move to the next step.

It will take a few minutes to complete, but then a build status of “package completed” will pop up. You can then simply click on the one-click download button and everything will download to a single location. From your new web host, use the FTP to upload the one-click download of the WordPress site.

After that, don’t forget to set your 301 redirects from the old pages to the new ones, as that is crucial to keeping your hard earned rankings.

You’ll need to upload the installer.php and the .zip archive of your old site. This can go straight into the root directory. Duplicator will walk you through the rest of the migration process.