This article help you to understand that how you can run your wordpress website on web(internet).
This article consists following things:
- Why i need to do so?
- How can i do it by myself without impacting website
- Difficulty level(Easy,Medium,Hard)
Total time consumed
Why i need to deploy WordPress website from localhost to Server?
A local server installed on your computer allows you to build and customize a WordPress website with ease and speed. Once you’re finished perfecting your website on your own computer, the next step is to move the website live and share your creation with the world. In this article, we will show you how to move WordPress from a local server to a live site, step by step.
How can i do it by myself without impacting website
This will include following steps:
Step 1: Export local server database
The first thing you need to do is export your local wordpress database.For this we will be using phpmyadmin.
You can open phpmyadmin by using simply http://localhost/phpmyadmin in your browser. And then click on export.
Step 2: Upload WordPress file to live site:
Now we will move our site files to the server.
For we need to login with FTP(filezila ,WinSCP,etc.). These are the tools are use for connect your local directory to the web server.
Step3: Create MySQL Database on Live site.
While your FTP client is uploading your WordPress files, you can start importing your database to the live server. Most WordPress hosting providers offer cPanel to manage your hosting account, so we’ll show you how to create a database using cPanel.
To get started, you can log in to your cPanel dashboard and click on the MySQL Databases icon which can be found in the databases section.
on next screen create your database .
Step4: Import WordPress Database on Live Site.
The next step in the process is to import your WordPress database. Go to your
cPanel dashboard, scroll down to the database section and click on phpmyadmin and this will take you to your new database.
Step5: Change the Site URL.
Now you need to change the site url in database so that it will connect to your live site.
Under the field options_name, you need to look for siteurl. Click the Edit Field icon which can be found at the far left at the beginning of the row.
When you click the edit field, an edit field window will appear. In the input box for option_value, you will see the URL of your local install probably something like: http://localhost/test. Carefully insert your new site url in this field, for example: wpbeginner.com
Save the field by clicking the Go button.
In this step you will change your local site url to your server site url.
Step6: Set Up Your Live Site.
Now that we have imported the database, and all of our content should be uploaded, it’s time to configure WordPress. At this time, your site should be showing an error establishing database connection.
To fix this error you need to edit your config.php via login with ftp or go into file manager and open your wp root folder.
This config.php file provide us the databse connection elements, like database name ,databse password which you created in above in step3.
After change the db name and db password you need to upload this file on server, and your site should be live now.
Step7: Fix Images and Broken Links by Updating Paths
whenever we move on live site from local. We get a problem of broken image links.
Foe solving this problem we need to run a sql query in mysql
UPDATE wp_posts SET post_content = REPLACE(post_content,