I recently switched a WP site from shared hosting to a VPS and would like to document the process here.

3 s
Put old host in read-only mode
- Go to WP Admin -> Settings -> Discussion and check “Users must be registered and logged in to comment”
- Disable authentication:
Create a PHP file inside the wp-content/mu-plugins folder, with the following content:
<?php
function wp_get_current_user() {
return new WP_User(-1);
}
This will prevent all logged-in users from leaving comments or creating posts on the old host.
Copy files and database to new host
I used FTP for transfering files and phpMyAdmin for exporting/importing the DB.
Handle DNS
- Point your domain to the new host’s IP address.
- Wait for propagation to take place.
Once the new DNS settings have propagated fully, you can nuke the old host.