| WordPress

Move A WordPress Site From Localhost To Production

So you have everything ready for launch and your site is sitting on your local computer. You're ready to move WordPress to the "real" server and start publishing.

Here's a step-by-step tutorial on how to export and import your data base, and get WordPress running on the new server.

Step #1. Prepare for the move

Make sure you have your website working perfectly on your local machine.

We are assuming the local environment is either a PC or Mac on which you run a web server (like XAMPP or WAMP) with PHP and a MySQL database and you have access to phpMyAdmin on localhost.

Have these access details handy:

  • FTP details - Hostname, username, password
  • access to phpMyAdmin on local host
  • access to phpMyAdmin on the destination server
  • database server name on destination server

Database Information on destination server:

  • database name
  • database user name (User must have full permissions)
  • database password

Checklist of steps to complete

  1. Search and replace http://localhost/yoursite with http://www.yoursite.com
  2. Export your local WordPress database to a text file.
  3. Create a database on your destination server and import your database.
  4. Copy all files from your local machine to destination server and amend wp-config.php file with new database details.

The easy way to do this is to go to Settings > General and change the WordPress address (URL) and the Site address (URL) to http://example.com. Or if it's going to be in a subdirectory, use http://example.com/subdirectory.

general settings

Save the changes.

You could also export the data base, then use a text editor to do a global search and replace for the URL.

THIS WILL GIVE YOU AN ERROR MESSAGE - but you can ignore it for now.


After you change the URL, if you try to visit your localhost/wordpress site, You may see only text or nothing, this is normal, since you have changed the URL, wordpress is looking for everything on the server, which is not ready yet.

Step #2: Go to phpMyAdmin


Depending on what local version you are using, find phpMyAdmin and open it. Here we're using XAMPP and you can get to the XAMPP menu by typing http://localhost in your browser address bar. Or you can get there from the XAMPP control panel by clicking Admin next to MySql.

<imgsrc="/cdn/images/stories/tutuploadsStep_4_-_Choose_the_correct_data_base_from_the_list_if_th.png" alt="tutuploadsStep_4_-_Choose_the_correct_data_base_from_the_list_if_th.png" width="532" height="158" />

In your phpMyAdmin control panel choose the correct database from your list of databases on the left. You created this data base and named it when you first installed WordPress in XAMPP.

Double click the name of the data base you want.

Step #3: Export the database

  • Click the Export tab.
  • Select All the database tables in the selection box.
  • Choose the type of file you want to export.
  • The default choices on the right hand side of the page will be OK.
  • Scroll down.
  • At the bottom, give file a name in the File name template field
  • Choose a compression type. zipped or gzipped are most used.
  • Click Go to start the export.
  • Save the file to your computer.
  • Save the file, you don't need to open it. You'll be using phpMyAdmin to import it to the destination.

Be sure to save it in a folder where you can easily find it. You will be importing this file to the server using phpMyAdmin on the server.

Step #4: Create a database on your new server


How you do this depends on what type of server control panel you have. You will need to check with your web host if you are not certain how to do this. Once you have created it, make sure you write down the data base host, data base name and the data base username and password . You will need them later.

Open phpMyAdmin on the destination server.

Your server control panel will have links to a way to create the data base, as well as a way to manage the database once it's created.

Step #5: Import the database

  • Click on the name of the one you wish to create, and make sure you are working with that database. There may be only one database, or if you do more than one website, you could have a list.
  • Browse for the file and import it into your new database.
  • Click the Browse button and find the file you saved on your local computer. Click the Go button, which you will find at the bottom of the screen to import the database.
  • You'll get a success message.

Step #6: Upload the WordPress Files

  • Use an FTP client to login to your server.

You should already have created the account on the server, and you have the login details from your hosting company Your FTP server (usually your domain name), your username and password.

The image above shows what the FTP connection screen looks like in Filezilla. If your domain name has not been propagated yet, you can also use the server IP address in the host field. I like to keep notes about my control panel access in the comments so I can find them easily.

Upload the entire contents of your local WordPress Installation from your local machine to the remote site.


In most cases you will want to upload everything, pictures, files and all directories to the /public_html folder on your server. Some hosting companies use /www as the place to put your web files. If you want to put it into it's own directory you can read more about it in the codex.

You will find the files to upload inside a folder in \xampp\htdocs\wordpress\ on your local computer. I named the folder wordpress, your folder name is whatever you created when you installed the site.

Step #7: Create the connection to your database


Open your wp-config.php file, located in the main WordPress directory in the new location, in a text editor and look for the section with the database information. You will see whatever you had set for the data base on your local server. Change this to the data base information for your new server (hopefully you recorded it when you created the data base. It should look something like this.


Different hosting companies use different naming conventions for usernames and passwords. Check with your hosting company if you need to.

Some hosting companies will use localhost for the MySQL hostname, and you won't need to change it. Some, like GoDaddy, use different servers for the data base and you won't be able to use localhost. You will need to check with your hosting company for the correct information.

You should now see the WordPress site in it's new location!