There are a number of advantages to constructing your localhost WordPress. Including the ability to avoid paying for hosting while you’re still in the construction stage. However, after your website is complete, you must move it to a live server. It’s a difficult task but we’ll get you there.
Fortunately, moving a WordPress website from a local server to a live server is less difficult than you would think. It operates in a similar way to migrating a website from one web host to another.
We’ll teach you how to move a localhost WordPress website to a live server. Either manually or with the help of a plugin, in this article.
But, what is localhost WordPress?
You’ll need to set up a local development environment on your computer to build a localhost website. This is essentially everything you’ll need to build and browse your website on your local machine. Including dependencies and software. To put it another way, you’re converting your personal computer into a local webserver.
Local WordPress development tools such as DesktopServer are also available. These bundles provide similar functionality to WAMP, XAMPP, or MAMP. Accordingly, the interfaces are arguably more intuitive and are constantly being updated.
Move WordPress from a Local Server to a Live Site Using a Plugin
When you’re set, the easiest approach to migrate a local WordPress website to a live server is to use a plugin. There are numerous WordPress transfer plugins available. However, we recommend All-In-One WP Migration.
This plugin is recommended since it is compatible with most web servers. It also allows you to export all of your WordPress files as well as your database in a tight formation.
To get started, you’ll need to perform the following:
- On your local website, install the plugin.
- Install WordPress and the plugin on your live server as well.
When you’re ready, navigate to the All-In-One WP Migration > Export tab on your local website’s dashboard. Choose Export To > File from the drop-down menu:
You could also utilise All-In-One WP Migration. That’s to replace any content in your databases. For example, if you’ve been operating locally and have been using an admin login like ‘root,’ now is the time to switch it.
Depending on the size of your website, the export procedure may take some time to complete:
You’ll be able to download a.wpress file that includes your full site, along with its database after the process is complete. Keep in mind where you’re going to save the file. Navigate to the All-In-One WP Migration tab on your live site and select the Import option:
You’ll be able to select the .wpress file you just downloaded to your computer if you click Import From.
The plugin’s premium edition allows you to restore backups from a directory that the plugin automatically creates for you. That’s if you want to import your local site through FTP. You may find this folder in your FTP client by going to public HTML.
Once inside, use FTP to upload your .wpress file to the following directory:
If you’re in All-In-One WP Migration > Backups now, you will see an entry for the .wpress file you want to use. Go along and select RESTORE from the drop-down menu next to that entry:
Irrespective of how you upload the .wpress file, the plugin will notify you that it will overwrite your entire site once you begin the import process. You’ll need to log back into WordPress after the process is complete. You’ll have to use the same admin credentials as you used for the local installation. Since you overwrote your databases with one from your local site.
You’ll require three things at first. A domain, a hosting, and a WordPress installation.
Domain name refers to the address of the website. This is what customers type into the search bar of their browser to go straight to your website. A domain name is one-of-a-kind and cannot be shared by many websites.
Web hosting is a service that enables you to upload your website files to the internet. As a result, your website is accessible to everyone with an internet connection. In practice, it usually refers to the services provided by a web hosting company such as BlueHost, Hostinger, and HostGator.
Most web hosts make installing WordPress on your server and getting your site up and running a breeze. They either provide step-by-step instructions or a one-click installation option. Once you’ve purchased your domain name and hosting plan, as well as installed WordPress on your new server, you can migrate your WordPress site from localhost to the server.
Related articles: How to install WordPress
Move Your localhost WordPress Files and Database Manually
In some circumstances, manually migrating a localhost WordPress website is preferable. It’s because some plugins struggle with large amounts of information. The manual procedure is a little more involved, but it’s not overly difficult.
You’ll need a few things to manually transfer a WordPress site:
- FileZilla Client, for example, is an FTP client.
- Through your hosting control panel, you can have access to the database of your live site.
- A completely fresh WordPress installation
Step 1: Upload Your Local WordPress Files to the Live Server
WordPress keeps all of your site’s files under the root folder. The root folder of a standard WordPress website should look like this:
Open the WordPress root folder on your live server. Then upload the entire contents of the appropriate folder for your local site.
The procedure can take a long time based on the scale of your site. However, you can start with the second stage of transferring your local site. Then replicating its database — in the meanwhile.
Step 2: Within your database, make changes to the URLs
WordPress uses single storage to keep all of your site’s data. You’ll need a tool like phpMyAdmin to explore this database locally.
The way you access your database may differ depending on which tool you use. In most circumstances, you should be able to access phpMyAdmin by typing localhost/phpMyAdmin into your browser. Of course, you’ll need to examine the documentation for the environment you’ve chosen.
Your local WordPress website is most likely using a URL like http://localhost right now. This implies that the address is used in all of your internal URLs for pages, articles, and media files.
To alter this, go to your database’s wp options table. Keep in mind that the wp_ prefix may vary depending on how your database is set up. You must see two rows at the top of the wp options table called siteurl and home once you’re in.
Look for option_value field under the Edit feature to the left of siteurl field. You’ll notice the URL for your local website there, so change it with the URL you created for your live site.
To save your modifications, click Go, and then continue the cycle with the home row. To save your modifications, click Go, and then continue the cycle with the home row.
Now you must run a simple SQL command to change your old localhost URL with your fresh one across the rest of your website and its inbound links:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/', 'www.domain.com/');
When you’re ready, click Go, and you’re done. You can now export the information of your database by heading to the Export option at the top of the screen.
You can click Go since phpMyAdmin will automatically set your database’s format to SQL. You’ll receive a .sql file that you’ll require in the next stage.
Step 3: Import the Database File’s Contents
Now you must use phpMyAdmin, which is installed on your live server, to access the database of your live site. You must have access to a control panel that offers a data access option, based on the web server you employ.
Go to the top of the screen and select the Import tab:
Ensure you’re loading data into your current server rather than overwriting an existing database in phpMyAdmin.
Your files should complete the uploading by now. There’s a file named wp-config.php among those files that contain your database name and access data. You won’t need to change ’em.
Select the .sql file you prepared a few moments earlier and click Go. Allow phpMyAdmin to perform its job. You must be able to view your migrated WordPress sites by accessing the live address after it’s finished.
If you don’t already have servers, building localhost WordPress sites is a good idea. Even if you do, having the ability to experiment with local WordPress development allows you to try out innovative features and test projects that you may not want to go live with just yet.