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
- Move Your WordPress Site to a New Server Using an XML File
- Other Forms of Migrations for WordPress Websites
- Final Thoughts
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.
- Using FTP or SSH, connect to your old server and locate the root folder of your WordPress Installation.
• The root directory will be where your entire website files reside. This is typically /public_html if the website you wish to move is your primary domain.
• If your installation is under a different folder such as /wordpress, you will want to focus on this folder instead. - 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.
- Using PHPMyAdmin, export your database and save it to your local computer.
For advanced users: You can also export your database through SSH.
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.
- Create a MySQL database on the new server.
Note: When creating your database, you will be asked for a database name, a username, and a password. Write these down as you will need them for future steps.
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.
- Open the wp-config.php file with a text editor.
- 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');Note: Typically, if you’re migrating WordPress to a server where the MySQL server and website are on the same server, you can just use localhost to let WordPress know to look locally for the database.
Save the changes made to your wp-config.php file before continuing.
Upload Files to New Server
- Using FTP or SSH, connect to your new server.
- Locate the root directory where you want your WordPress installation to reside, this directory location is important.
Note: If you’ve installed WordPress to a subfolder such as /public_html/wordpress, ensure to upload the files there.
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.
- Import your WordPress database into your newly created database using phpMyAdmin.
Note: For advanced users, you can also import your database through SSH.
Note: When the database has been imported successfully, you should see a message at the top of the page similar to: Import has been successfully finished, ## queries executed.
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
- Log in to your WordPress Dashboard on your old server.
- Hover over Tools, then click on Export
- Under Choose what to export, leave All content selected and click on Download Export File.
This will download an XML file, which may look like the following example: exampleone.wordpress.YYYY-MM-DD.xml - 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.
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.
Note: Make sure to replace the necessary folders on your new installation or upload the subfolders and files directly into the new installation to avoid errors caused by multiple folders.
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
- If you haven’t already, log in to your WordPress dashboard on your new server.
- Hover over Tools, then click Import.
- Now click on the last option for WordPress.
- On the WordPress Importer screen that pops up, click on Install Now.
- Next click on Activate Plugin & Run Importer.
- Click on the Choose File button, select the WordPress export you created, then click on Open.
- Once the file name appears, click “Upload file and import”.
Note: If you get an error message stating “The uploaded file exceeds the upload_max_filesize directive in php.ini” you may need to increase the maximum file upload size for WordPress.
- 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.
- Under Import Attachments select Download and import file attachments, then click Submit.
Note: This step is crucial as it uses the images transferred from your Uploads folder and adds them to your new Media Library, ensuring that all of your images are saved in the appropriate areas on your new installation.
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.
- How to Migrate a WordPress site from WP Engine
- How to Transfer a Website From Weebly to WordPress
- How to Transfer a Website from Squarespace to WordPress
- How to Transfer a Website from Wix to WordPress
- Moving Websites Built with Older Technology into WordPress
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!
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!
Great to hear, Devid! Hope the migration process goes smoothly.
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.