Worried that shifting your WordPress site to an online server won’t work?
You’re right to be. If migration is done incorrectly, it could cause errors that are hard to detect and resolve.
Many give up on moving WordPress from a localhost to a server because it’s just too hard.
That said, there is a way to do it without any hiccups.
We’ll show you the right tools to use and give you step-by-step instructions so that your WordPress site is up and running on a server in no time.
The easiest and safest way to migrate your site from localhost to server is using a plugin like All-in-one migration. Install the plugin on your local site and export your site’s files. Next, install the plugin on your new WordPress site on your live server and import the same files. After you’re done, make sure you backup your WordPress site so that you always have a safety net to fall back on when things go wrong.
Getting Started on Moving WordPress from Localhost to Server
There are a few different scenarios where you would want to move your site from localhost to server:
1. You’ve set up WordPress on your device and built a site locally.
2. You have a backup or a package of an old site that you want to bring to life again.
3. You’ve already tried moving your site and are facing errors.
We’ve covered all three scenarios by detailing the safest error-free method. We also show you other methods,the errors you may encounter, and how to fix them.
To begin, when you want to move your site from a localhost to a live server, you first need three things:
If you have this in place, skip ahead to the steps. If you don’t already have these basics in place , here’s how you can get them:
- Domain Name
A domain name is your website’s address, such as blogvault.net. You can purchase a domain name from domain registrars like Domain.com, Namecheap.com, GoDaddy.com, and Dynadot.com.
- Web Hosting
To host your website online, you need to get a server. The most popular option is to sign up with a web host like BlueHost, HostGator, WPEngine, and Kinsta.
Many platforms like GoDaddy and NameCheap offer both domain registration and hosting together as a starter package which works out great for beginner sites.
Under hosting plans, the cheapest ones are the shared hosting plans, where your website will share a server with other websites. While this is an economical option, it may not be the most secure solution.
If you can afford it, it’s better to opt for dedicated servers or container host solutions like Convesio.
Here’s a list of the best WordPress hosting providers to choose from.
- WordPress Installation
Most web hosts make it easy for you to install WordPress on your server to set up your site. They either have a one-click installation process, or step-by-step instructions are provided.
You can also follow our guide on How To Install WordPress if you need more information.
Once you’ve purchased your domain name and hosting plan, and set up WordPress on your new server, you can move your WordPress site from localhost to the server.
How to Move WordPress from Localhost to Server
Broadly speaking, there are two ways you can move your site to a server from your local device:
The easiest and safest way to do this is using a plugin. When you move your site, there are a number of elements at play and the process is sensitive. The slightest misconfiguration—even if a single line of code is out of place or omitted — your site won’t function.
How To Use A Plugin To Move WordPress from Localhost to Server
There are two plugins that can make this entire process a breeze: All-in-One WP Migration and Duplicator.
Of the two, Duplicator requires a little technical knowledge. All-in-one WP Migration takes away the technical part making it very easy to complete the process directly from your WordPress dashboard.
Both plugins are equally good. It depends on your own preference. We’ll show you how to use All-in-one Wp Migration. Let’s begin.
Note: All-in-one WP Migration supports sites that are less than 512mb for free. If your site is larger than that, you can upgrade to the premium version which is just $69 with lifetime access.
Step 1: Export your local site
1. On your local WordPress website, select Add Plugins. Search for All-in-One WP Migration plugin. Install it and then Activate it.
2. From the dashboard panel on the left, select the All-in-One WP Migration. A menu with three options will appear: Import, Export, and Backup. Choose Export.
3. The page that opens will give you a number of options to export your site. First, there’s an option to find particular text in your local database and replace it with another. You can keep adding as many replace commands as you want.
And next, you can also choose Advanced options if you don’t want to export certain elements of your site.
You do not need these options. The All-in-one WP Migration plugin will take care of renaming the elements of the site to the URL that you import to.
These are advanced features that are meant for slightly more experienced users, who may want to customise the migration using these options. Any change made here can affect your user access details for the site. We strongly recommend skipping this, especially if you are unsure about the process.
5. Click on Export To and a menu will appear. Select File.
That’s it. All-in-one WP Migration will create a copy of your site. The time taken greatly depends on the size of your site.
6. Once complete, you’ll see an option to Download the file.
Downloading the file will also take a while. An average WordPress site may take 10-20 minutes.
Step 2: Import the file to your live site
1. Go to the WordPress installation you set up with your web hosting provider. Log into the wp-admin and access the WordPress dashboard.
2. Install the All-in-one WP Migration plugin here as well.
3. Select the plugin and then select Import.
4. On the Import page, select Import from to get the same dropdown menu. Select File.
5. Now choose the file that you just downloaded from the localhost server.
This process will take a couple of minutes, but it’s well worth it as the plugin handles all the heavy lifting for you.
The plugin will notify you when the import is complete, and you’ll be asked to log in to your website.
And that’s it, folks. Using the All-in-One WP Migration plugin, you have successfully migrated WordPress site from your local server to a live server.
Now, we understand that there may be reasons you want to use the manual method. Maybe your site is larger than 512mb or the plugin doesn’t support your site.
For those brave enough to opt for the manual method, follow the steps as explained in our next section.
How to Move WordPress From Localhost to Server manually (NOT RECOMMENDED)
CAUTION: We strongly recommend using a plugin to migrate your site. The manual method is prone to error and entails a very tedious process. Attempt this method at your own discretion, and only if you are comfortable using WordPress.
To manually move your site, you need to do two things:
First things first. Here are the steps to follow to migrate your WordPress files to the live site.
i) Migrate WordPress Files from Local site to Server
You can use either cPanel or FTP to upload your files to your new server. We’ll show you how to use both tools.
PRO TIP: If you don’t know where to find your WordPress files, they should be in the folder you selected when you installed WordPress locally. You can search your computer for the wp-config file and find the directory.
1. Upload your WordPress files using cPanel
If your web host grants you access to cPanel:
1. Log into your webhosting account, go to cPanel > File Manager.
2. Access the folder called public_html.
3. Here, you can Upload your files. You can choose to overwrite the existing files.
2. Upload your WordPress files using FTP
If you don’t have access to cPanel, you can use an FTP client like FileZilla to achieve the same goal. You will need to fetch your FTP Credentials from your web hosting account.
1. Install and open Filezilla on your computer. Enter your FTP credentials – Hostname, Username, Password, Port and hit Quickconnect.
After making the connection, you can migrate the WordPress files of your local site to the live one.
2. In the FTP client, the right panel has the filesystem of your new website on the live server. Select the public_html folder.
The left panel similarly has the filesystem of your local computer. Open the directory where your local WordPress website is installed. Select the local site files and right-click to get the Upload option.
The process will take a while to complete. In the meanwhile, let’s go ahead and move the local database to the live site.
ii) Migrate database from the Local site to the Live site
Next, you need to transfer the local WordPress database to your server. WordPress supports only MySQL and MariaDB databases.
If you have your database file ready, skip ahead to uploading your database. If you don’t have your database, here’s how to get it.
Step 1: Export Local Database
First, you need to export your database. To do this, you’ll need to access phpMyAdmin.
1. Add /phpmyadmin at the end of the local website.
For instance, if the local WordPress website URL is – localhost:8080
add /phpmyadmin at the end of the URL – localhost:8080/myphpadmin
2. To log in, enter the username root and the password that you use to access your local WordPress website.
3. Now select your database from the right panel. Choose to Export your database.
PRO TIP: If you don’t know your database name, you can find it in the wp-config.php file.
4. On the Export page, choose Quick – display only the minimal options and choose SQL format.
That’ll export the localhost database, as a file, to your computer.
Step 2: Create a new database on the Live site.
In this new database, you’ll upload the localhost database that you just downloaded.
1. To create a new database, log in to your web hosting account. Go to cPanel. Under the Databases section, you’ll find an option called MySQL Database.
2. Selecting it will take you to a page where you can create a new database. Enter a name of your choice.
3. Go back to the same page, scroll down and create a new user. Add a username and password and store this information safely.
4. Again, go back to the same page and add the user to the database you created.
5. As soon as you add the user to the new database, you’ll be asked to set database privileges for the user. You can check the All Privileges box or select individual privileges from the list.
Step 3: Import your local database on the live site.
1. Next, from the same cPanel, open phpMyAdmin.
2. Choose the new database and then select Import.
3. Upload the database MySQL file that you had downloaded earlier. Click on Choose file, select your file and press Go.
That’s it, you’ve successfully moved your local WordPress site to a live server. But it’s not yet over. There are a few details to take care of.
Post Migration Steps While Moving WordPress from Localhost to Server
When you migrate to a live server, you’ll likely face a number of issues. To ensure this doesn’t happen, you need to make sure your configurations are correct.
1. Configure Your New Domain In Database
After you import your database, open the wp_options table and select Edit. You need to change the location of your website in this table.
- Locate the words ‘siteurl’ and ‘home’. Edit these two rows.
- For siteurl, under option_value, replace the old name with the new domain. Press enter to save.
- Next for home, repeat the same step. Replace the name with the new domain name and hit enter.
2. Configure Your wp-config File
You need to ensure that your website uses the new domain name and the new database you set up for your site. You can ensure this by editing your wp-config file.
- Go to cPanel public_html and find the wp-config.php. Right-click and Edit this file. In case you’re using FTP, you can download the file. Open it in any text editor to make the changes.
- Find the following lines:
Make sure instead of example.com, it displays your new domain name.
- Next, you need to replace the old database details with the details of the new database you created. You need to enter the database name, database user, and database password.
- In cPanel, close the file to save your edits. If you’re using FTP, re-upload the wp-config file and overwrite the old one.
3. Fix Your New Domain URLs
Next, you need to fix your URLs manually.
1. Log into your WordPress dashboard and go to Settings > General.
2. Here, you’ll see two fields – WordPress Address and Site Address. Make sure both these fields have your new domain name.
3. Ensure the URL doesn’t have a slash at the end. Both fields should end with correct TLD such as .com or .co.uk or .org.
4. Once done, Save Changes.
PRO TIP: Sometimes, you may notice that some URLs haven’t been updated. To overcome this, install the Velvet Blues Update URLs on your new site.
In the New URL field enter your new domain name. Make sure there is no trailing / at the end. Under Choose which URLs should be updated, select all boxes except the last one Update ALL GUIDs. Then select Update URLs NOW.
5. In your wp-admin panel, go to Settings > Permalinks. Select the URL structure you use, this is usually post-name. Select Save changes.
PRO TIP: If you’re seeing errors, try clearing your browser cache and your website’s cache. This will delete any stored data and show you only fresh data.
4. Test Your New Domain
Before you launch your site, we strongly recommend running a few tests to make sure the site is functioning perfectly:
1. Check all your main pages. Make sure none of them have errors.
2. Make sure all your button links or custom theme layouts work fine.
3. Ensure all Logos and Favicon files bear your new domain name. You can find these files under Appearance> Theme Options.
4. Check custom menu items that you can find under Appearance > Menu
5. If you have a WooCommerce site, ensure that your add to cart, checkout, payment gateway, and any other important functions are working properly.
6. You can use a tool like https://nibbler.silktide.com/ to check if there are any broken links and broken images, and other errors on your new domain.
PRO TIP: If you’re using third-party plugins and services, make sure you change the domain name with them as well.
Bonus: Errors Faced with Moving WP from Local to Server
The reason we’ve added this section is because there are many recommendations and solutions out there to move your site from a localhost to a server.
But many of these methods end up breaking your site or causing problems with the URLs which end up in HTTP errors and database errors.
Here are some of the issues you might face when you try different methods, especially the manual one:
- Data Serialization
In many programming languages, serialization helps organize data in a way that it has data types and number of elements in every data type.
The problem here is that data including URLs is set in concrete structures and becomes difficult to move data around. Moving your site means moving data and if you manually modify data such as searching and replacing the domain URLs in your database, you could corrupt the serialization and cause errors on your site.
- Errors in WordPress database
While setting up the database of your WordPress site, if the database information is incorrect in your WordPress settings, it will cause an unresponsive error such as Error establishing database connection.
- PHP errors
A major chunk of WordPress is powered by PHP – a programming language that’s responsible for the appearance and functionality of your site.
When you move your site to a server, it could cause incompatibility issues or exhaust your PHP memory limit. This leads to PHP errors and warning messages showing up on your site.
- Server errors
It’s best to use a WordPress plugin like All-in-one WP Migration that will take care of the technical issues for you so that you don’t face these issues.
If you are already facing these issues, follow our guide to WordPress troubleshooting to these fix these errors. You can also get help from fellow WordPress users on the WordPress Support Forum or popular forums like Reddit, StackExchange, and StackOverflow.
With that, we’ve come to the end of our guide on how to move your WordPress site from localhost to server.
Now that your website is online, there are a few steps we strongly recommend to keep your site safe. There are many advantages to moving your site to an online server, but there are serious threats that you need to protect your site against.
1. Always take regular backups of your website. Things can go wrong and things will go wrong at some point. It’s best to be cautious and have a safety net to fall back on at all times. You can automate and schedule your backups with BlogVault. When things go wrong, you can restore your site in one click. Check our list of the best backup plugins available.
2. Hackers are always on the prowl and WordPress sites are a lucrative target. To protect your site, you need a firewall and a security scanner active on your site. You can install any one of the security plugins from the WordPress repository. Among these plugins, MalCare is a top performer as it automatically installs a robust firewall and scans your site every day. It protects your site from hackers round the clock.
3.Ensure your site is using an SSL certificate and is running on HTTPs and not HTTP. This ensures all data transferred from and to your site is encrypted and safe from hackers.
Apart from this, there are a couple of recommended steps to take when you make your site live. Here are a few articles you might find helpful
With that, we end our guide. If you’ve successfully moved your local site to a server or fixed any errors you were facing using this guide, we’re glad we could help! Give us a shoutout on twitter. We’d love to hear from you.
Backup your site With BlogVault!