[Request] Wordpress from localhost to vps migration.


New Member
Good Day, can someone give a better secure tutorial of migrating wordpress site from localhost to vps with the complete better file/folder permissions. I have a bunch of wordpress site that are hosted locally on a desktop machine and will be migrated to a vps. Thanks in advance.
Last edited by a moderator:


Active Member
Verified Provider
Are you running some kind of control panel on the VPS?

Actually you should simply SFTP the files to your VPS in their respective folders for each domain, restore the MySQL databases, and (probably) use the WP_HOME & WP_SITEURL directives in each sites wp-config.php to set the real URL of each WordPress site (more about that here: )


Active Member
The best solution is to create a database dump and replace the localhost URL's with the new URL's in server, using a text editor. For eg., replace all to

Then upload it to the VPS. You might also need to replace few directory paths like "/var/www/wordpress" in your local system to match the path in your VPS. Usually, its used by plugins.

In the VPS, download the latest wordpress, extract it, replace the wp-content folder with your local files and configure the installation using wp-config.php file.

You will be good to go with that.


Content Contributer
I moved about 9 wordpress blogs and you have to care about the file paths and the domains.

  1. Copy database
  2. Copy files
  3. edit wp-config.php

    define('WP_HOME', '');
    define('WP_SITEURL', '');

  4. Run following SQL commands
    update wp_postmeta set meta_value = replace(meta_value, '/old/directory', '/new/directory');
    update wp_options set option_value = replace(option_value, '/old/directory', '/new/directory');
    update wp_usermeta set meta_value = replace(meta_value, '', '');
    update wp_options set option_value = replace(option_value, '', '');
    update wp_comments set comment_author_url = replace(comment_author_url, '', '');
    update wp_posts set post_content = replace(post_content, '', '');
    update wp_posts set post_excerpt = replace(post_excerpt, '', '');
    update wp_posts set guid = replace(guid, '', '');
That's it.


New Member
I have moved wp sites before and i always forget how and what files and folders should i change permissions. This is where i always messed up the migration. And nope i don't use cp, just the command line for all.


Active Member
While the manual methods given above are the good ways to learn, I personally prefer to use Duplicator plugin for any WP site migration irrespective of server environment. It takes care of lot of that manual stuff.

As for file permissions you might want to go through this WP Hardening codex page.