If you want to accelerate your development process, then to develop your WordPress website on localhost is a smart way. In previous WordPress guides, we have specifically talked about how to install WordPress on your Windows PC by using WAMP. After you have made your WordPress on your PC perfect, then you should go to move the site live and publish your interesting and valuable content to the public.
With the purpose of making your pretty WordPress website go to in front of users around the world, we are to tell you the steps of transferring your WordPress site from localhost to a live site. By the way, BackupBuddy and Duplicator are both easy-to-use WordPress plugins for this.
Before you start the process, you have several things in place. One thing is having an ideal WordPress website running on a localhost with full access. The second is having a web hosting with your domain name that you can choose from our Best WordPress hosting providers. Bluehost is a premium option for this, which receives a wide range of awards in the industry.
At present, Bluehost managed WordPress hosting comes with 50% off discount and 1 free domain, starting at $19.99/mo instead of normally $39.99/mo. It is set up within VPS environment, offering customers the increased privacy, reliability and security.
The last thing is having a FTP program and knowing how to use it to upload your WordPress website content to your new live site. Now, you can start the process!
1. Export Local WordPress DB
When moving your Word Press site on a localhost, you need firstly export the database for your local WordPress. You have set up WordPress management, phpMyAdmin before, so to export the database, you need to use the feature as well. It is very simple.
Firstly visit http://localhost/phpmyadmin/ page and click on “Export”meta box on the top menu bar.
Then, you will have two options of exporting your WordPress DB: “Quick” and “Custom”. If you choose “Quick”, then you just need to select the format of the DB and click on “Go” to perform the process; “Custom” option offers you more choice to make customization for the database export, but here we think it is better to choose “Quick” option to export your WordPress DB.
2. Upload Your WordPress Files to Your Live Site
Now, you have downloaded all your WordPress files from local DB, and the next step is to upload them to live site. For this, you need to open your FTP client to connect to your new web hosting account at first.
After connecting to your live site, you need to ensure you upload your WordPress files in rich directory. For instance, if you plan to host the WordPress site on yourwebsire.com, you will need to upload all your WordPress files in the public_html directory. Makes sense these things, you can start process: choose your WordPress files > upload it to the live web server.
3. Create a MySQL DB on Your Live Site
You can begin to import local database to the live server as your WordPress local files are uploaded to your live server.
Many managed WordPress hosting providers includes free cPanel in their packages, and we will illustrate using cPanel to create databases in below.
Firstly, log into your cPanel and go to its dashboard, on which you can directly find an icon of "MySQL Databases" under "Databases" section and click on the icon.
Then, you will have a new windows showing “Create New Database”. On the screen, you need to enter a name for your live site database and then click on the button of “Create Database”.
Next, you can get down to adding or creating a current MySQL database user to the new one in the section of “MySQL Users”.
Once you add the user to the new MySQL database, your cPanel will enable you to set up MySQL privileges for the user. You just need to check all boxes as following to grant the user all privileges and finally click on “Make Changes”.
4. Import WordPress DB on Your Live Site
Now, you have created a new MySQL database on the live server, and the next is to import it for your WordPress on the live site. You can simply go to cPanel dashboard, go down to “Database” section, and click on “phpMyAdmin” which will take you to the database you just created and show you new databases as well.
Simply click on the tab of “Import” in the top menu, and you will get to a import page, where you just need to press the button of “Choose File” and then choose the database file that you saved in the first step. Finally, click on “Go” in the bottom and then phpMyAdmin will import the new WordPress database.
5. Change Your Site URL
After setting up WordPress database on the live site, you can move to change your site URL in your database to make it connect to your live WordPress website.
Go to phpMyAdmin and find the databases you imported above to look for “wp_options” table. On the table, you should click on the “Browse” behind “wp_options” to open a page listing fields in “wp_options” table as following:
Under “options_name” field, you should find “siteurl” in the first. Now, click on “Edit” button in the beginning of each row.
Now, there will be a new window appearing for editing. In the window, you will see some boxes for entering values for each option. In these boxes, you should find a URL of your local WordPress and where you will need to enter new URL for your live site to replace the old one, such as http://www.wpyoursite.com. After the change, you can move to click on “Go” button to save your change in this field.
Now, you need to do the step again for changing the RUL for “home” wp_option. Note: It is possible that your “wp_options” page could be as long as several pages, so you need directly find the “home” tab which is usually on second page that you can navigate to in the means of pressing the pagination arrows in the phpMyAdmin.
Then, you just need to change “home” url into the new url of “siteurl”.
6. Set up the Live Site
By far, you should have finished the process of importing your WordPress database and uploading your content to the live site. It is time to set up your WordPress live site. At present, your WordPress live site should be displaying a message of “Error Establishing Database Connection”. You need to fix the error to make it normal to the public.
For this, you need to use a FTP client to connect to you site and here you can edit the “wp-config.php” file. You are required to offer the name, user as well as password of the database you just created before, save the configuration file and finally upload it to you live server back. After that, you visit your WordPress site again, and you will find it is live now.
Then, log into WordPress admin dashboard and click on “Settings” >> “General”. On the “General” page, you do not have to change anything but just go down to the bottom of the page and press “Save Changes”. It is to make sure your live site URL is always corrected no matter where it will be.
The next is visit “Settings” >> “Permalink” to click on “Save Changes” to guarantee all your post links are corrected.
7. Update Paths to Check for Bad Images & Broken Links
Transferring a WordPress website to a new domain or a live site is always a heavy and complicate task, so it has high risks at missing images or links. So, after you complete all transferring steps, you have one thing you can miss. It is to check for broken links and missing images. To make it easier, you can take advantage of Velvet Blues WordPress and SQL query.
If you use SQL to solve the problem, it will be finished very simply via a SQL query which should be like:
Go to your phpMyAdmin, on which you just need to press your DB and click on “SQL” tab in the top menu. Then there will be notice showing “Run SQL query/queries on database xxx” and in below, you will see a blank field to enter your SQL query. There is one thing you have to remember that is to change the query with your localhost site as well as your live site’s URLs.
After fix all broken links and missing images, you have gone through the whole process of moving your WordPress localhost site to the live site. Of course, you can be cautious to check for everything on site right by visit your live site.
If you have ever done this job, and have anything more to recommend to other users, welcome to leave your suggestion in comments.