Learn how to move WordPress from Localhost to a Live Server. Our WordPress Support team is here to answer queries and concerns.
Move WordPress from Localhost to Live Server | 2 Methods
Moving a WordPress site from the local environment to a live server can seem daunting. However, with the right guide, you can accomplish this without running into any errors.
Whether you’re planning to go live with a basic install or something more complex like a WordPress subdomain setup with NGINX, the following methods will help you do it right.
Today, we will walk you through two methods to transfer a WordPress site: the manual method and using a migration plugin.
An Overview:
Method 1. Migrate WordPress Site Manually
- 1. Back Up the Local WordPress Site
- 2. Upload WordPress Files to the Live Server
- 3: Export the WordPress Database
- 4. Create a New Database on the Live Server
- 5. Import the Database to the Live Server
- 6. Update wp-config.php
- Method 2. Migrate WordPress Using a Plugin
- 1. Create a Migration Package
- 2. Create a Database on the Live Server
- 3. Upload Migration Files to the Server
- 4. Run the Duplicator Installer
- Final Checklist: After Migration
Method 1. Migrate WordPress Site Manually
This method offers us full control over our files and database. Here’s how to move the WordPress site step-by-step.
1. Back Up the Local WordPress Site
Before starting the migration, complete the site backup. We need a fallback to avoid losing content or settings if anything goes wrong. Make sure to back up WordPress files and the WordPress database.
2. Upload WordPress Files to the Live Server
Use an FTP client like FileZilla to upload the local site files:
- Open FileZilla and connect to the live server using the SFTP credentials provided by the hosting provider.
- On the left pane, navigate to the local WordPress folder (containing folders like `wp-content`, `wp-admin`, etc.).
- Move to the right pane and go to the server’s public directory (usually named `public_html` or `www`).
- Then, select all files in the local folder, right-click, and choose Upload.
3: Export the WordPress Database
Next, export the local database. This contains all the content, settings, and configurations.
- Using phpMyAdmin:
- Open phpMyAdmin and select the local WordPress database.
- Then, click the Export tab.
- Next, choose Quick as the export method and SQL as the format.
- Finally, click Go to download the `.sql` file.
- Using Adminer:
- Launch Adminer and select the local database.
- Click Export on the left menu.
- Then, set Output to Save, and Format to SQL.
- Click Export to download the file.
If you run into errors during this step or after import, such as “Error establishing a database connection”, here’s a helpful guide to fix WordPress database connection errors.
4. Create a New Database on the Live Server
Now, it is time to create a new blank database on the hosting account:
- Log in to the cPanel and go to the MySQL Database Wizard.
- Then, create a new database and take note of the name.
- Now, create a new MySQL user and assign it a strong password.
- Finally, add the user to the database and grant All Privileges.
5. Import the Database to the Live Server
- Open phpMyAdmin via cPanel.
- Select the newly created database.
- Then, click the Import tab.
- Next, choose the exported `.sql` file and click Go.
6. Update wp-config.php
To connect the live site with the new database:
- Use FTP to open the `wp-config.php` file.
- Then, update the database settings as seen here:
define('DB_NAME', 'the_database_name');
define('DB_USER', 'the_database_user');
define('DB_PASSWORD', 'the_password');
define('DB_HOST', 'localhost'); // Usually 'localhost' unless specified otherwise
- Save and re-upload the file to the live server.
We have successfully migrated the WordPress site manually from localhost to a live server.
Method 2. Migrate WordPress Using a Plugin
If we prefer a faster and more error-proof method, using a plugin like Duplicator, Migrate Guru, or All-in-One WP Migration is ideal. Let’s take a look at how to do it with Duplicator.
For a full walkthrough, you can also check out our dedicated article on how to migrate a WordPress site using Duplicator.
1. Create a Migration Package
- First, install and activate the Duplicator plugin in the local WordPress dashboard.
- Then, go to Duplicator > Packages and click Create New.
- The plugin will scan the site. Click Build to package the site.
- Once done, download both the Installer and Archive files.
If issues are detected, such as PHP errors or timeouts, we will see symptoms like a 500 Internal Server Error in WordPress.
2. Create a Database on the Live Server
- Go to cPanel > MySQL Databases.
- Then, create a new database and user.
- Assign the user to the database with All Privileges.
3. Upload Migration Files to the Server
- Open FileZilla or the FTP client.
- Then, upload the installer.php and Archive file (from Duplicator) to the root directory (`public_html` or `www`).
4. Run the Duplicator Installer
- In the browser, go to `https://thedomain.com/installer.php`.
- Now, Duplicator checks your server environment to ensure it’s ready for deployment. It verifies PHP version compatibility, File permissions, Archive integrity, and Server settings like execution time and memory limits.
If any issues are detected, they’ll be flagged with a warning or error. Once all checks are passed or acceptable, click Next to extract the archive package onto the server.
- Then, it is time to install the Database. This step connects our WordPress files to the new database we created earlier.
First, choose Connect and Remove All Data. Then, enter the database credentials:- Host: Usually localhost
- Database Name
- Username
- Password
- Click Test Database to ensure the connection works. If the test passes, Duplicator will display a green success message. Click Next to begin importing the site’s database into the new server.
- In the next step, the Duplicator automatically updates all references to the site URL, path to files on the server, and serialized data in the database.
Review the settings on this page and confirm that the URL reflects the live domain. Also, make sure the path points to the correct root folder. Additionally, check that the site title and admin email are correct.
- Click Next to proceed.
- Finally, it is time to verify that the migration was successful. So, click the Admin Login button to access the WordPress dashboard. Before logging in, check the box for “Auto delete installer files after login.” This will remove installer.php and archive files for security.
- Then, log in using the existing WordPress admin credentials. Once logged in, Duplicator will confirm that all installation files have been deleted and that the site is fully live.
- After logging in, go to Settings > Permalinks and click Save Changes.
- Test the site on the front end and ensure that pages, images, and links work correctly.
- Additionally, check the WordPress admin dashboard for any plugin or theme updates.
The plugin takes care of URL replacements and configuration updates automatically.
Final Checklist: After Migration
Regardless of whether you migrate manually or via a plugin, make sure to:
- Test the site thoroughly on the front end.
- Check that all media, links, and forms work as expected.
- Remove any leftover installation files (if not already deleted).
- Re-save the permalinks in WordPress under Settings > Permalinks.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Migrating the WordPress site from localhost to a live server doesn’t have to be stressful. The manual method gives us complete control, while plugins like Duplicator simplify the process drastically. We can choose the method that suits our needs.
In brief, our Support Experts demonstrated how to move WordPress from Localhost to the Live Server.
0 Comments