Moving WordPress to another host
Because WordPress is database-driven, it’s more complicated to move it from one server to another than a standard HTML site would be. With a HTML site, moving the files would be sufficient (as long as you used relative vs. absolute link structures), WordPress requires both the files and database to be migrated.
Manual Database Migration > WordPress Import/Export XML
The best way to go about moving WordPress to a different location is to move the files manually vs. using WordPress’ Import/Export function through the admin area. To move WordPress manually, you will need file transfer access (FTP, sFTP) and, commonly, something like PHPMyAdmin on both hosts, as well as a MySQL database on the new location where WordPress is being moved. I’m going to describe how to do it with PHPMyAdmin access and sFTP/FTP access. It is a major help if you have some familiarity with PHPMyAdmin if you are moving WordPress this route. The steps I would recommend taking this route are:
1) First, export the WordPress database from its current location via PHPMyAdmin. If you have never done this before, a quick Google search should provide helpful documentation articles, such as this.
2) Next, back up all of the site files from their existing location via FTP/sFTP.
3) On your local copy of the files, change the wp-config file to reflect the new location’s MySQL database information by updating the database name, username, password and potentially host if the servers vary on their usage of localhost.
4) Logging into PHPMyAdmin on the new server, import the WordPress database backup created in Step 1 into the new database. Again, if you are not familiar with PHPMyAdmin, if you do a basic Google search for importing into databases in PHPMyAdmin you can find more detailed tutorials.
5) In the database you just imported, there are likely a lot of references to the old WordPress location in the site URL and home URL, as well as content. Running MySQL queries on the database is the easiest way to catch all of these instances and update it to reflect the new WordPress location. If you click here, you will be taken to an amazingly helpful blog post detailing some WordPress database queries. During a location change, you would want to run: Change siteurl & homeurl, Change GUID (possibly, not always), Change URL in Content and Update Post Meta. Once you’ve run these queries, your database is prepped and ready to go for your new location.
6) Depending on the circumstances behind the move, how you approach transferring the files may differ. For instance, if I am moving a WordPress site to replace a live HTML site, I may add DirectoryIndex index.html index.php to the .htaccess file so that the client’s HTML site is prioritized before I upload any WordPress files. That way, I don’t interfere with their existing site until WordPress is fully ready to go. If I am replacing an existing WordPress site, I typically create a temporary splash page while I change out the files. If it’s a completely new server with nothing there, that’s the easiest and the files can just be uploaded without worrying about anything beyond that.
7) Once the files are in place and the database has been migrated, you will want to refresh Permalinks at the new location. The easiest way to do this is to log into the WordPress admin at the new location and go to Settings -> Permalinks and just click Save.
Your WordPress site should now be fully migrated! I know moving WordPress manually may seem overwhelming, especially at first, but once you’ve done it a couple times, it is a breeze. At this point, I feel like I could move WordPress in my sleep. Additionally, of course this is only one way WordPress can be moved. Depending on the tools used in your development process, you may be pushing from Git, working with SSH, or other methods.
WordPress Migration with Plug-in Assistance
Additionally, there are plug-ins out there like BackUpBuddy, Duplicator, WordPress Move and WP Migrate DB that are supposed to help you with parts of this process. I have used WP Migrate DB to sync local and live databases but I still mostly do manual migrations. There are definitely options available to you if you’d like to avoid manual migration, should you wish to explore them!