Easily move WordPress site to new server

Easily move a WordPress site from WordPress.com to a self-hosted WordPress install or migrate your WordPress site from one server to another using these simple steps.

Move WordPress site from WordPress.com to self hosted

Using WordPress.com you can export your pages, posts, comments, categories, and tags. Then import this content into a self-hosted WordPress install, just worrying about your plugins, themes, or widgets from that point.

Export your WordPress site from WordPress.com

If you already have a site on WordPress.com just follow these steps to export your data:

  1. Log in to your WordPress.com dashboardIn my example this is: https://JacobIMH.wordpress.com/wp-admin
  2. Hover over Tools, then click on Export
  3. Under Export Option, click on Export
  4. Under Choose what to export, leave All content selected and click on Download Export File
  5. Take note where you download the jacobimh.wordpress.YYYY-MM-DD.xml file to

Create blank WordPress site to import data into

Now that you have your WordPress site data exported to your local computer, you’ll need a fresh WordPress install on your server to import that data into.

  1. Either install WordPress with Softaculous, or install WordPress manually
  2. Then login to your WordPress dashboard
  3. Hover over Tools, then click Import
  4. Now click on the last option for WordPress
  5. On the WordPress Importer screen that pops up, click on Install Now
  6. Next click on Activate Plugin & Run Importer
  7. Click on the Choose File button, select the WordPress export you created, then click on Open
  8. Now click on Upload file and import
  9. Under the Import author either type in a new user name you’d like to assign the imported posts to, or beside or assign posts to an existing user click on Select and choose an existing userAlso under Import Attachments select Download and import file attachments, then click Submit

Finished with WordPress.com migration

You should now have successfully moved your WordPress.com site to its own self hosted WordPress install!

Now you just might want to login to your WordPress dashboard and start adding any Plugins, Themes, or Widgets that you had been using on WordPress.com.

Move WordPress to a new server

If you already have WordPress installed on a server, and would just like to move it to another server this can be accomplished easily as well.

The benefit of doing a full WordPress migration from one server to another is that it brings over everything you’ve done in WordPress up to this point, including Plugins, Themes, and Widgets.

Download WordPress site content from old server

When migrating a WordPress site to a new server, first save all of the current content from the previous server:

  1. Using FTP, connect to your WordPress site on your old server
  2. Download all files in your document root directory, typically /public_html to your local computer

    Install WordPress to a folder like /wordpress? Just download that folder instead.

Download WordPress database backup

With the WordPress files saved to your computer, next you need a copy of your WordPress database:

  1. You want to export your WordPress database with phpMyAdmin

Create MySQL database on new server for WordPress

Since you’ve got the WordPress database backed up, the next step is creating a new database to import that into.

  1. Create a MySQL database on the new serverTake note of the Database name, Database user, and Database password you’ve setIn this example here is what I wrote down:Database name: example_wrdp1Database user: example_wrdp1

    Database pass: myDBpassword

Modify downloaded wp-config.php file with new database

Before uploading your WordPress files to the new server, you need to adjust your wp-config.php file with the new settings.

  1. From the WordPress files you downloaded, open up the wp-config.php file with a text editor
  2. You will want to modify the highlighted code with the new server’s database info you took note of:
    /** The name of the database for WordPress */ define('DB_NAME', 'userna5_wp12');  /** MySQL database username */ define('DB_USER', 'userna5_wp12');  /** MySQL database password */ define('DB_PASSWORD', 'FGdgA%#5');  /** MySQL hostname */ define('DB_HOST', 'mysql.example.com');

    So for our example we end up with:

    /** The name of the database for WordPress */ define('DB_NAME', 'example_wrdp1');  /** MySQL database username */ define('DB_USER', 'example_wrdp1');  /** MySQL database password */ define('DB_PASSWORD', 'myDBpassword');  /** MySQL hostname */ define('DB_HOST', 'localhost');

    It’s important to point out that the DB_HOST might have been a hostname previously on your old server. Typically if you’re migrating WordPress to a server where they MySQL server and website are on the same server, you can just use localhost to let WordPress know to look locally for the database.

Upload WordPress files to new server

Now that your wp-config.php file is adjusted for the new server, upload all your files there.

  1. Using FTP upload your downloaded WordPress files to the new server

    If you’ve installed WordPress to a folder like /wordpress, make sure to upload the files there.

Import WordPress database backup to new server

The last step in a WordPress migration to a new server is importing the WordPress database backup to the server

  1. Import your WordPress database using phpMyAdmin

Finished moving WordPress to new server

You should now have successfully migrated your WordPress site from one server to another!

You might want to login to your WordPress dashboard to ensure everything is working now on the new server.

IC
InMotion Hosting Contributor

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

10 Comments

  • I am searching on google how to migrate WordPress website and I find your post. Hopefully, now we can migrate WordPress website easily. Thank you!

  • First, this was an excellent tutorial. Worked perfectly. I’m going to use this sequence for my web design business, pulling a client’s site over to a dev server, doing my work, and then sending it back to the client’s server.

    My question: Once I’m done working the client’s site, what process do I follow to migrate it back to their server and replace their old site? This exact process but in reverse?

    Thanks,

    Jason

    • Hello Jason,

      Thank you for contacting us. Yes, you would use the same process to migrate the files back to the older server/site.

      Thank you,
      John-Paul

  • Hi, thanks for that great tutorial, i have a question.

    Do you know if exist some tool (paid or free) that makes this migration completely automatically?

    Because if i have a couple sites this is ok, but if i have 30 or 40 websites consume lot of time.

    Thanks.

    • Hello Wilson,

      Unfortunately we are not aware of a tool that exist to completely migrate the WordPress website. However that is a great idea for a future plugin.

      Best Regards,
      TJ Edens

  • Thanks for the video.  Great tempo and clarity! Made the process much less daunting that all the writeups I’ve seen.  

    Couple of questions:

    I’ve read in several places that as a last step before exporting the database and exporting the WP files, you can change the WordPress URL and Site URL in Settings > General to the new domain and save.  Is that even possible?  You obviously won’t have access to the old site any more via the domain, but this in theory would eliminate having to make the URL changes in the new database tables, correct?

    Also, if I use the same database, name/user/password combination on the new server database, the only thing I would need to change in the wp-config.php file would be the dbHost, correct?

     

    Thanks again.

    • Hello Chris,

      If I followed what you were saying correctly that is how it should work. It is a relatively simple process anyway so if a couple of places need to be revisited that is also fairly easy to adjust.

      Kindest Regards,
      Scott M

  • Great video and article. I  have an additional question. By mistake I installed all of the wordpress files in the document root of hcp-consulting.org

    I would like to move it now to a sub directory in the root. Does this work exactly the same way? How does it work it if it is in the root in a directory called “hcp”  – how do I make it that site visitors can access it by  going to hcp/consulting.org instead of hcp-consulting.org/hcp ?

    Thanks for your help and the great instruction you posted

     

    Christian Hofer

    • Hello Christian,

      Thanks for the comments! Moving a WordPress location isn’t really all that difficult, but you should definitely take care in making the move. Our tutorial on Moving WordPress will give a good reference point and the steps needed for the move. You can also find a complete article on moving WordPress from one location to another here.

      In answer to your last question, the steps for that process are provided by WordPress in their documentation: Giving WordPress its own directory.

      I hope this helps to answer your question, please let us know if you require any further assistance.

      Regards,
      Arnel C.

Was this article helpful? Let us know!