Manually move WordPress Site from local server to live server

0
29

Manually move WordPress Site from local server to live server

Developing a WordPress site through local server is often preferred by developers who are new to WordPress. Developing WordPress site locally also enhances the site development speed. After you’ve completed your website on local server i.e. on your own computer, you need to make your website live. To make website live means to move your website from local server to live server. So, in this blog we are going to talk about how to move WordPress website from local server to live server manually.

Things to do before you start

Before you start moving your website from local server to live server, you need to have prepared your website in local server. For this you need to have installed WordPress in your local server. Now, we are hoping that you already have completed your website in local server so that it can be moved on live server. Make sure you also have a domain name and web hosting.

If you need to know about Domain Name or Web Hosting, you can have a look on our previous blog Difference Between Domain Name and Web Hosting.

Also, you need to be familiar with a FTP program and show know how to upload your files through FTP.

Now after completing all above process you must be ready to move your site. So, let’s start migrating your WordPress site and make it live.

Step 1: Export Local Sever WordPress Database

The first step is to get the database by exporting it from your local WordPress database. For this using phpMyAdmin is the easiest and we’ll be using that.

You’ll need to go to http://localhost/phpmyadmin/ and click on your WordPress website database. Now, click on the Export given on the top menu as shown in snapshot below.

Select Quick as the export method and format must be SQL. Then click on Go button and save the database sql file.

Step 2: Upload WordPress Files to Server through FTP

Now the in next step you’ll need to upload your WordPress site files to the server using FTP. For this open your FTP Client and connect to your hosting account by filling up authentic credentials.

After you are successfully connected to your FTP account, carefully upload the files in the right directory. For example if you want the site to be hosted on www.example.com, then you’ll need to upload all the files in your public_html directory.

Now select your local WordPress files and right click, now start uploading them to your live server, as shown in the snapshot below.

Step 3: Create MySQL Database on Live Server/Site

As your FTP Client starts uploading your WordPress files, you can start setting up your database to the live server. For this you’ll first need to import database. Most of the hosting providers offer cPanel to manage your hosting account, so we’ll show you how to create a database using cPanel.

Go to your cPanel and log in to your cPanel dashboard and click on the MySQL Databases icon which can be seen in the databases section, as shown in the snapshot below.

On the next step, you’ll see an option to enter a name for your database and a Create Database button, as shown in the snapshot below. Enter the name for your database and click the button to save it.

After you’ve created the database, scroll below to the MySQL Users section and create or add an existing user to the database.

After you have added the User, next you’ll be asked to set MySQL privileges for that user. Carefully check all select boxes to grant all the privileges , and then click on Make Changes button to save.

Step 4: Import Local WordPress Database on Live Site

After setting up the configuration of database in cPanel you’ll now need to import the WordPress database. For this you’ll have to visit cPanel dashboard, click on phpMyAdmin inside databases section. You will now at phpMyAdmin interface, there you’ll need to click on database name that you created in Step 3. This will show your database with no tables.

Now, you’ll need to import your local database that you saved in Step 1. On the top menu click on Import tab, then click on Choose File button and then select the database file you need to upload. Click on Go button and this will import your database.

Step 5: Change the Site URL

To connect the database to the live website, you’ll need to change the site URL in the database. For this, click on table wp_options of your database that you have imported in step 4.

Open the page by clicking on the Browse button following wp_options. See screenshot below:

Now in the options_name column, look for siteurl field value. Next click on the Edit field as shown in the snapshot below:

Now you will see the edit window with input boxes for each column. Change the value of column option_value, from something like: http://localhost/test to your new site url  for example: http://www.example.com

Click on Go Button to save. Now, you’ll have to repeat the above step for option name: home. Change the home url same as your siteurl.

Step 6: Set Up Your Live Site

After completing the above steps if you visit your site, that would be showing an Error Establishing Database Connection error. to solve this, you’ll need to edit the wp-config file. For this connect to your website using an FTP client and start editing wp-config. Change the database name, user and password you created earlier in Step 3. Save the file and upload it to the server. And now, your site must be live.

Now, login to your WordPress admin panel and go to Settings » General. Click on the Save Changes button at the bottom without changing anything. By doing this will fortify all your site’s URL. Then secondly go to Settings » Permalink and click Save Changes to make sure all your posts links are also updated.

Step 7: Fix Images and Broken Links by Updating Paths

Whenever you are transferring your WordPress site from one domain to another, or from local server to a live site, you’ll have the issue of broken links or missing images. You can fix this by using SQL Query.

1
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.example.com/');

Visit your phpMyAdmin interface, click on your database and then click on SQL from top menu. Write above query, and replace  www.example.com/ with your own live site URL. Click on Go to run the above query. This will fix all the broken links issues.

That’s it! By doing the above steps successfully your WordPress site will be live. Just be sure to follow all steps carefully and use your own site data like url or database to be successful on the first attempt.