Move Your WordPress Site to a New Server

Move Your WordPress Site to a New Server - Hero Image

Moving your WordPress site between servers can be seen as a challenging technical task, but it is easier than you may imagine.

In this article, we will cover the website migration of your WordPress website to a new server manually or with an XML file. There will also be further resources on moving your website from specific hosting providers, or when using migration plugins.

Move Your WordPress Site using cPanel

Because of WordPress’ open source nature, websites using their technology can easily be transferred between hosting providers. 

One of the important aspects you want to check when migrating your website is what kind of control panel they use, as you will need to know where to find your files when creating and downloading backups to your computer. For the purposes of this guide, we will use cPanel as a frame of reference and image sources.

Download Your Site Content

Downloading your website content is the first step to getting it to a new server. This is similar to making a backup, you want to ensure your plugins, theme, and files are all intact on the new server. 

  1. Using FTP or SSH, connect to your old server and locate the root folder of your WordPress Installation.
  2. Download all files in your root folder to your computer.

Download your Website’s Database

Once you have all of your files downloaded, you will need a copy of your WordPress site database. 

Your site’s database is the brain of your website, it contains all text, settings, and important information that is needed to run WordPress.

If you are unsure what your database name is, you can find this information by checking the wp-config.php file from the root directory of your website. This will look similar to the example below:

/** The name of the database for WordPress */
define('DB_NAME', 'userna5_wp01');
/** MySQL database username */
define('DB_USER', 'userna5_wp01');

Once you have this name, you can find your database through your Control Panel’s database section, or through a tool such as PHPMyAdmin.

  1. Using PHPMyAdmin, export your database and save it to your local computer.
Exporting a Database through phpMyAdmin screenshot highlighting the Database section

Create A New MySQL Database

Once all of your old server files have been downloaded locally, you will need to connect to your new server in order to start the migration process. 

  1. Create a MySQL database on the new server.
creating a MySQL Database through the cPanel Database Wizard

Modify wp-config.php File

Once your files are up on your new server, you will need to connect your installation to the new database you created. 

To connect your files to this database, the wp-config.php file has to be adjusted to the new database information you saved when creating your new database (refer to Create A New MySQL Database section if needed). 

Your website’s wp-config.php file can be found under its root installation folder. 

  1. Open the wp-config.php file with a text editor. 
  2. You will want to modify the bolded code with the new server’s database info you took note of:
    /** The name of the database for WordPress */
    define('DB_NAME', 'userna5_wp02');
    /** MySQL database username */
    define('DB_USER', 'userna5_wp02');
    /** MySQL database password */
    define('DB_PASSWORD', 'FGdgA%#5');
    /** MySQL hostname */
    define('DB_HOST', 'localhost');

Save the changes made to your wp-config.php file before continuing.

Upload Files to New Server

  1. Using FTP or SSH, connect to your new server. 
  2. Locate the root directory where you want your WordPress installation to reside, this directory location is important.

Import Old Database

With your website installation completed and your new database connected, the last step you need to do is import all of the information from your old database into your new server.

  1. Import your WordPress database into your newly created database using phpMyAdmin.
Importing a Database through phpMyAdmin screenshot

Complete Your Migration

If your migration is successful, and your website is pointed to your new server’s nameservers, your website will now be fully accessible.

Because you copied your database, your WordPress username and password will be the same as in your previous installation. Ensure to reset your WordPress permalinks once you have logged in to your dashboard.

Move Your WordPress Site to a New Server Using an XML File

While not as popular as other forms of migrations, you can transfer your text files and information between WordPress installations using an XML file.

This process eliminates the need to download your root directory, making it simpler for some users. However, there are a few things to keep in mind when using this method:

  • You will still need to download your Uploads folder to access your images on the new server.
  • Similarly, you should download your Theme and necessary Plugin folders, as these will be affected by the migration.

While not required, we recommend using FTP or SSH to move your files to ensure a smooth process.

Export Your Website

  1. Log in to your WordPress Dashboard on your old server.
  2. Hover over Tools, then click on Export
  3. Under Choose what to export, leave All content selected and click on Download Export File.
    Exporting an XML file from WordPress

    This will download an XML file, which may look like the following example: exampleone.wordpress.YYYY-MM-DD.xml
  4. Take note of where you downloaded this file.

Download Your Uploads and Theme Folders

As your XML file only contains your text data, it’s important to migrate your images and design aspects, such as your Theme files, from one server to another.

To do this, you can use your server’s control panel software, FTP, or SSH to download these files to your computer.

Using cPanel File Manager to download the Uploads and Themes folders will ensure you image and other files are available in your new server. You may also need to download certain Plugin folders if they are needed for your website's visuals.

Ensure that you note where you download these files as they will need to be placed in the root directory of your new WordPress installation after the next step.

Create a New Site to Import Data 

With your WordPress data successfully downloaded, you need to create a new installation on your new server to import the data into. You can use a tool such as Softaculous to one-click install WordPress or install WordPress manually.

Upload Your Uploads and Theme Folders 

On your new server, locate the root directory of your new WordPress installation and upload the folders you downloaded in Step 2. 

After uploading the folders, access your new installation dashboard and activate the necessary plugins that impact your site’s appearance.

These may include:

  • Widgets
  • Menu Plugins
  • Any other plugin that actively affects the appearance of your site

Once your plugins and theme are functioning properly, you can proceed to import your XML file.

Importing Your XML File

  1. If you haven’t already, log in to your WordPress dashboard on your new server.
  2. Hover over Tools, then click Import.
  3. Now click on the last option for WordPress.
    Importing an XML file with WordPress
  4. On the WordPress Importer screen that pops up, click on Install Now.
  5. Next click on Activate Plugin & Run Importer.
  6. Click on the Choose File button, select the WordPress export you created, then click on Open.
  7. Once the file name appears, click “Upload file and import”.
  8. Under the Import author, type in a new user name you’d like to assign the imported posts to, or to assign posts to an existing user click on Select and choose an existing user.
  9. Under Import Attachments select Download and import file attachments, then click Submit.
    Importing Attachments

Complete Your Migration

Once your migration is complete and your website is pointed to your new server’s nameservers, your website will be fully accessible. However, it’s important to remember to reset your WordPress permalinks once you’ve logged into your dashboard.

One potential drawback of this type of migration is that you’ll have to manually re-add any Plugins, Themes, or Widgets from your previous WordPress installation if you left out any of those folders during the migration process. However, unlike the earlier example, you won’t need to copy, import, or export any databases.

Other Forms of Migrations for WordPress Websites 

There are many ways to migrate your WordPress website between hosts or servers, but some of them may require third-party plugins or additional steps to set up. For example, if you’re migrating from a different Content Management System (CMS) like Drupal, you’ll need to follow a different process.

To help you with your migration process, we’ve compiled several articles that may be useful.

Move Your WordPress Site to a New Server with a WordPress Plugin 

Using plugins to migrate WordPress can be a helpful option, especially for those who are new to the CMS or prefer a more hands-off approach. Although the migration process may vary depending on the plugin, you can be confident that your information will be moved safely to your new server.

However, regardless of the plugin you choose, it’s highly recommended that you create a backup of your content before making the move.

Move Your WordPress Site to a New Server from a Specific Hosting Provider

It’s important to note that not all web hosting services are compatible with WordPress. Some companies may have proprietary software that cannot support WordPress, or they may have a specific process you need to follow to move your website away from their hosting service.

To help you navigate this process, we’ve compiled several articles that will walk you through the process of migrating your website’s content from some of these companies.

Final Thoughts

Congratulations on successfully moving your data to a WordPress website on a new server! To ensure that everything is working properly, make sure to point your nameservers if you haven’t done so already. You should also test your website to ensure that nothing is missing.

If you prefer to test your website before pointing your DNS, you can create a Host file on your computer. This will allow only you to see your site on your new server before pointing to your nameservers. If you’re interested in learning more about how to protect, optimize, secure, and expand the functionality of your WordPress site, be sure to check out our WordPress Educational Channel!

Shay Bravo
Shay Bravo Digital Content Producer

Shay is a Digital Content Producer for InMotion Hosting with a passion for WordPress and Web Design. Her focus is making content for users to understand WordPress and Tech better, no matter their skill level.

More Articles by Shay

10 thoughts on “Move Your WordPress Site to a New Server

  1. 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!

  2. 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

    1. 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

  3. 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.

    1. 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

  4. 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.

    1. 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

  5. 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

    1. 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? Join the conversation!