Are you interested in uploading WordPress from a localhost to live server?
Utilizing WordPress on a local server is a common method for working on your site privately. Eventually, you will need to migrate it to a live server to make it accessible to online visitors.
In this post, we will present you how to Upload WordPress From localhost to live server in 2024
Reasons for Migrating WordPress From a Localhost to a Live Server
Constructing your WordPress blog on a localhost provides a secure environment for testing changes on your website without impacting visitors.
Once you have perfected your website, the next phase involves migrating it from your local server to a live site.
We will guide you through two different methods for moving your site from a local server to live server.
The first approach involves utilizing a WordPress migration plugin and is particularly recommended for beginners.
In the second approach, we will demonstrate how to manually transfer WordPress from a localhost to a live server.
Preparations Before Migrating Your WordPress Site
Before you can migrate WordPress from a localhost to a live server, you need to ensure a few prerequisites are in place.
Initially, we assume that you have a WordPress site running on a localhost on your computer, and you have complete access to it.
Subsequently, you will need to own a domain name as well as web hosting.
To facilitate your decision-making process, we recommend opting for Bluehost. They are an officially endorsed WordPress hosting company, offering an exclusive discount + free domain and SSL for all users.
Essentially, you can commence for as low as $2.75 per month.
If you seek an exceptional Bluehost alternative, consider Hostinger. They are also extending an exclusive discount to All users along with a free domain name.
If you require assistance in setting up your website, follow our detailed guide on how to install a WordPress website.
Lastly, you will need an FTP program and possess knowledge of how to use FTP to upload your local server site to the live server.
Ready? Let’s initiate the migration process for your WordPress site.
Approach 1: Transferring WordPress From the Localhost to the Live Server Using a Migration Plugin (Recommended)
This approach is simpler and recommended for beginners. We will be utilizing a WordPress migration plugin to transfer WordPress from localhost to a live site.
Step 1: Installation and Configuration of the Duplicator Plugin
Initially, you need to install and activate the Duplicator plugin on your local site.
After enabling it, head to the section Duplicator » Packages and press the ‘Create New’ option.
This action will take you to a screen where you can assign a name to your backup.
Subsequently, hit the ‘Next‘ button.
Duplicator will then execute certain checks to examine if everything complies.
If all items are tagged as ‘Good‘ then select the ‘Build‘ Button.
This process may require a few moments, depending on your website’s size. It is essential to keep this tab open until the process concludes.
Upon completion, you will find download choices for the ‘Installer‘ and ‘Archive‘ packages. You need to hit the ‘One-Click Download‘ link to acquire both files on your device.
The ‘Archive‘ file comprises an entire replication of your WordPress site, encompassing all WordPress central files alongside your visual content, uploads, themes, plugins, and a backup of your WordPress database.
The ‘Installer‘ file constitutes a script that will automate the entire migration process by unpacking the archive file housing your site.
Stage 2: Generate a Database for Your Live WordPress Website
Before you can operate the installer or upload the WordPress site from localhost to your server, you’re required to form a MySQL database for your fresh live site.
If you have previously established a MySQL database, this step can be omitted.
To establish a database, visit your hosting account’s cPanel dashboard. Afterward, pinpoint the ‘Databases’ division and select the ‘MySQL Database Wizard‘ icon.
On the following screen, there’s a section for constructing a new database.
Simply furnish a title for your database and tap the ‘Create Database‘ button.
cPanel will create a new database for you.
Post this, you’ll need to input a username and password for your recent user and then click the ‘Create User‘ button.
To proceed, the writers, you need to include the user you freshly constructed in the database. Initially, tick the ‘All Privileges’ checkbox.
Then, proceed downwards and select the ‘Make Changes’ button to store your modifications.The database is now set to be applied with your WordPress site. Make certain to jot down the database name, username, and password. You’ll need this info in the following step.
Step 3: Transfer Files from Localhost to Live WordPress Website
Currently, you are required to transfer the archive and installer files from your local site to your hosting account.
Initially, connect to your live site using an FTP client. Upon connection, make sure the primary directory of your website is entirely clear.
Generally, the central folder is the /home/public_html/
directory.
Some WordPress hosting firms automatically install WordPress upon registration. If there are WordPress files there, you must delete them.
Following that, you can transfer the archive.zip and installer.php files from Duplicator to your vacant root directory.
Step 4: Executing the Migration Script
Once you have transferred the migration files, you must go to the following URL in your web browser:
http://example.com/installer.php
Remember to change ‘example.com’ with your own domain name.
This will initiate the Duplicator migration wizard.
The installer will run several assessments and activate the script.
Beneath the Setup section, you will be prompted to input your MySQL host, database name, username, and password.
Your host will probably be localhost. Subsequently, you will enter the specifics of the database you fabricated in an earlier phase.
Then, hit the ‘Validate’ button to confirm the accuracy of the details you provided.
After that, tap the ‘Next’ button to proceed.
Duplicator will now transfer your WordPress database backup from the archive to your new database.
It will also revise URLs directing the local site to your new live site.
You can now press the ‘Admin Login’ button to access the WordPress admin section of your live site.
Once logged in to your live site, Duplicator will automatically clear up the installation files.
This concludes the process. You have effectively transferred WordPress from the localhost to your live site.
Approach 2: Manually Relocate WordPress From the Localhost to Live server
In this approach, we will present you with the manual mode of transferring WordPress from the local server to your live website. It will come in handy if the initial procedure is not productive or if you would rather do it manually.
Step 1: Export Local WordPress Database
To begin with, the first step involves exporting your local WordPress database. You will use phpMyAdmin for this purpose.
Simply visit http://localhost/phpmyadmin/
and select your WordPress database. Then, click on the ‘Export’ option from the top menu bar.
In the ‘Export method:’ section, you can choose either ‘Quick’ or ‘Custom’. The ‘Custom’ option will present you with more alternatives for exporting your database.
However, we suggest selecting ‘Quick’ and then clicking the ‘Go’ button to fetch your database.
Step 2: Upload WordPress Files to Live Site
Subsequently, we will have to transfer all your website files to the live site.
To start this process, proceed to open your FTP client and connect to your web hosting account.
Once you have successfully connected to your live site, ensure that you upload the files in the appropriate directory. For instance, if you want the site to be hosted on ‘yoursite.com’, then you should upload all the files in your public_html
directory.
Now choose your local WordPress files and transfer them to your live server.
Step 3: Create a MySQL Database on Your Live Site
While your FTP client is busy transferring your WordPress files, you can initiate the process of importing your database to the live server.
Most WordPress hosting providers provide cPanel for managing your hosting account.
Initially, you need to log in to your cPanel dashboard and click on the ‘MySQL Database Wizard’ icon located in the ‘Databases’ section.
Next, on the following screen, you can create a new database.
You are required to specify a name for your database, and then click ‘Create Database’.
cPanel will then proceed to automatically create a new database for you.
Afterward, you need to input a username and password for your new user, and then click ‘Create User’.
Subsequently, you will need to add the user you just created to the database.
Initially, check the ‘All Privileges’ checkbox.
After that, proceed downward and click on ‘Make Changes’ to store your modifications.
You have effectively established a new database for your active WordPress website.
Stage 4: Bring in WordPress Database to Active Site
The following phase in the process is to integrate your WordPress database.
Head to your cPanel dashboard, scroll to the ‘Databases’ section, and select ‘phpMyAdmin’.
This action will redirect you to phpMyAdmin, where you must select the database you recently created. phpMyAdmin will display your new database devoid of any tables.
Subsequently, select the ‘Import’ tab in the upper menu. On the import page, tap on the ‘Choose File’ option and then pick the database file from the local site you stored in the initial step.
Afterwards, press the ‘Go’ option at the end of the page. Your database will be automatically brought into phpMyadmin.
Step 5: Adjust the Website URL
Now, you must modify the website URL in your database to enable connectivity with your active WordPress site.
In phpMyAdmin, locate the wp_options
table in your database, which you imported earlier.
If you altered your database prefix, then the table might be {new_prefix}_options
instead of wp_options
.
Then, click on the ‘Browse’ icon adjacent to wp_options
. Alternatively, click the link on the side to reveal the page containing a list of fields within the wp_options
table.
Subsequently, in the options_name
column, find the siteurl
option.
Then, select the ‘Edit’ symbol.
This action will display a window for modifying the field.
In the input box for option_value, you will find the URL of your local installation, which will resemble http://localhost/your-local-host-url
.
You should insert your new website URL in this field, for example: https://codepen.blog
.
Subsequently, save the field by clicking the ‘Go’ option.
Next, follow the same steps as before for the home
option name. The wp_options
menu might span multiple pages. Typically, the home
option will be on the second page.
After that, update the home
URL to match your active site URL.
Stage 6: Establish Your Active Site
Now that you have integrated the database and uploaded your content, it’s time to set up WordPress.
At this point, your site should display an ‘Error establishing a database connection‘ error.
To resolve this issue, establish a connection to your website using an FTP client and access the wp-config.php
file.
You will need to search for the subsequent lines of code:
1
2
3
4
5
6
7
8
9
|
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME' , 'database_name_here' ); /** MySQL database username */ define( 'DB_USER' , 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD' , 'password_here' ); /** MySQL hostname */ define( 'DB_HOST' , 'localhost' ); |
You will be required to input the database name, username, and password you generated previously.
Then, save the wp-config.php
file and re-upload it to your WordPress hosting server.
Subsequently, when you access your website, it should be operational.
Once done, access your WordPress admin panel and navigate to the Settings » General section. Afterwards, without making any modifications, scroll to the bottom and click on the ‘Save Changes’ button.
This action will ensure that your site URL is corrected wherever necessary.
Once completed, move to the Settings » Permalinks section, then scroll down and click on ‘Save Changes’ to confirm that all post links are functioning properly.
Step 7: Rectify Images and Broken Links by Updating Paths
Whenever you are relocating a WordPress site from one domain to another or from a local server to a live site, you will encounter broken links and absent images.
An easy method to modify the URLs is by utilizing the subsequent SQL query:
1
|
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/' , 'www.yourlivesite.com/' ); |
Simply access phpMyAdmin, select your database, and then choose ‘SQL’ from the top menu and input the query above.
Remember to customize it to your own local site and live site URLs and then click on the ‘Go’ button.
That’s all. You have successfully relocated WordPress from your nearby server to a live site.
Conclusion
In conclusion, Uploading WordPress from a localhost to a live server is a crucial step in making your website accessible online. Whether using a migration plugin for a beginner-friendly approach or opting for manual transfer, the process involves steps like database creation, file uploads, and URL adjustments.
The recommended Duplicator plugin simplifies the task, while the manual method provides flexibility. Ensure a smooth transition by following each step meticulously, and once completed, your WordPress site will be live, and ready for online visitors. Take the time to rectify broken links and images, and your website will seamlessly integrate into its new online environment. Happy website launch!
Free Tips One: How To Use Ftp Or Sftp Server To Transfer Files In 2024
Free Tips Two: Complete Beginner’s Guide: How To Install WordPress Easily
Free Tips Two: Ultimate Guide To Install And Setup WordPress Multisite
1 comment