A WordPress migration does not have to be difficult. Here are the necessary steps (some of which are optional):
:
1) Transfer the file system to the new server
2) Export the old database
3) In the exported old database, replace the old paths with the new ones (oldsubdomain.olddomain.com/oldsubdirectory with newsubdomain.newdomain.com/newsubdirectory). This replaces both the configuration paths and the paths to images, PDF files, etc.
4) Create a new database and import the exported old database into the new database
5) Adjust the path information and database details in the wp-config.php file in the main directory
6) Adjust .htaccess (e.g. RewriteBase)
If you are not running a WP Multisite, the migration is now complete (hopefully*). However, operators of a Multisite installation must make one additional change. Without this additional change, you will generally receive the message "Error establishing a database connection" (not to be confused with "Error establishing a database connection" caused by incorrect database details in wp-config.php). This error message is generated in the file \wp-includes\ms-load.php and is only displayed in full when you are logged in as an administrator (which is of course difficult due to the previous course of the installation). If you display the error message by changing the following line in the file \wp-includes\ms-load.php (around line 237)
if ( ! is_admin())
for example, to
if ( ! is_admin() && 1==2)
you will be informed of an incorrect declaration within the wp_blogs table. This was not covered by step 3 above because the domain and path are stored separately here. Therefore, as WordPress Multisite operators, we still need to perform the following step 7:
7) In the wp_blogs table, appropriately adjust "domain" and "path"
8) Done
* If text widgets are not displayed on the frontend, see here.
