How to move local WordPress site to hosting server

Posted by & filed under Troubleshooting, Tutorials.

If you want to create a website, the best way is to start developing the site on your local PC server and save money on the hosting during the development phase. Once you are finished with the development of the site, you can then move your site over to a live server. In this article we will explain how you can do this.

Prerequisites

  • WordPress Site on a local server like, WAMP or MAMP with full access, i.e to the database and all the files of the site.
  • Web Hosting that supports WordPress Sites and provides FTP access to the site.
  • Database Manager like, Adminer or PHPMyAdmin and knowledge of how to use it. We would be using Adminer for the screenshot examples for this article.
  • FTP Client like FileZilla.
  • Note down where on the site absolute paths are used. These would later be needed to change to the live server specific path.

Move local WordPress Site to Server

Step 1 : Export the local WordPress Database

  •  Open ‘Adminer‘ and select the WordPress Database.
  •  Export and save the database as a CSV or SQL file.

 

move1

 

 

 Step 2: Correct URL paths

  • Open the exported database file in any text editor that has a ‘search and replace‘ feature.
  • Run a search and replace on the database file and replace the local url with that of your domain.

Edit : This step might break any serialized data for a plugin. To avoid any such problem we suggest using one of the many ‘Search and Replace’ plugins available.

move2

 

 

 

Step 3 : Upload WordPress files to server

  • Using a FTP client access your hosting server and search for a directory named ‘public_html‘ or ‘www‘ (name may vary depending on your hosting company).
  • Copy all your WordPress files from local website directory to the live server website directory.

 

move3

 

Step 4 : Import the Database file to the server

  • Open the Site Database on your server using ‘Adminer‘. If the server does not have a database already for the new site, you will have to create one.
  • Select the Database and press “Import” button placed on the left sidebar for ‘Adminer’.
  • Upload the SQL/CSV file of the local site to the Server database.

 

move4

 

 

Step 5 : Edit ‘wp-config.php’

  • Using a FTP client again open the ‘wp-config.php’ file from the site files you transferred to the server.
  • In this file you have to edit the following 3 lines :

define(‘DB_NAME’, ‘your_database_name’);
define(‘DB_USER’, ‘your_database_user’);
define(‘DB_PASSWORD’, ‘your_database_password’);

move5

 

 

That’s all, hopefully your live site will now be up and running. Check your site to make sure that every thing is working fine as expected.

2 Responses to “How to move local WordPress site to hosting server”

  1. Mikael Mälarström

    Hi, your step 2 above will brake any serialized data, like in widgets acf fields and so in. Insted – use a search and replace tool that will allow replacements in serialized data. Google for WordPress search and replace. InterconnectIT is a good option!

    Reply

Leave a Reply