Start a FREE 7 day trial! Get training videos and books, plus expert support:  

WordPress Tutorials and Blog Posts

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.

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.

Your destination server needs Apache or IIS,

Have these access details handy:

Be sure you have your URL chosen and registered and pointed at your production server.

  • 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 https://localhost/yoursite with https://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.

Step 1: Change the URL

tutuploadsStep_1_-_Change_the_url_on_your_localhost_site_to_the_URL.png

The easy way to do this is to go to Settings > General and change the Wordpress address (URL) an the Site address (URL) to https://yourwebsite.com Or if it'sgoing to be in a subdirectory - https://yourwebsite.com/subdirectory

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.

tutuploadsmedia_1314660883144.png

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

tutuploadsStep_3_-_Go_to_phpMyAdmin_and_get_ready_to_export_your_da.png

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 https://localhost in your browser address bar. Or you can get there from the XAMPP control panel by clicking Admin next to MySql.

tutuploadsStep_4_-_Choose_the_correct_data_base_from_the_list_if_th.png

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

tutuploadsStep_5_Go_to_the_export_tab__select_all_the_tables__choos.png
  • 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.
tutuploadsStep_6_-_Name_the_file_you_are_about_to_export__choose_a_.png
  • 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.
tutuploadsStep_7_Click_Go_to_start_the_export..png
  • Save the file to your computer.
tutuploadsStep_8_Save_the_file_to_your_hard_drive_or_local_media..png
  • Save the file, you don't need to open it. You'll be using phpMyAdmin to import it to the destination.
tutuploadsmedia_1314662910418.png

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

tutuploadsStep_9_Create_a_data_base_on_your_server..png

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

tutuploadsStep_10_Open_phpMyAdmin_on_the_destination_server_and_cho.png
  • 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.
tutuploadsStep_11_Browse_for_the_file_and_import_it_into_your_new_d.png
  • 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.
tutuploadsmedia_1314728917552.png
  • You'll get a success message.

Step 6: Upload the WordPress Files

  • Use an FTP client to login to your server.
tutuploadsStep_12_Use_an_FTP_client_to_login_to_your_server..png

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.

tutuploadsStep_13_Upload_the_entire_contents_of_your_local_WordPres.png

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

tutuploadsStep_14_Create_the_connection_to_your_data_base..png

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.

tutuploadsmedia_1314731710155.png

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 site in it's new location!

 

Start a FREE 7 day trial! Get training videos and books, plus expert support: