There are times when you need to move WordPress around within your server, and times when you need to move WordPress from one server to another. You don’t need to re-install. WordPress is flexible enough to handle all of these situations.

Steps to Deploy WordPress From Localhost To Your Web Server

  1. Export your Database from the localhost using phpMyAdmin as a .zip
  2. Extract the zip locally somewhere for editing.
  3. Open the .sql file in editplus/notepad (or equivalent UTF-8 capable editor) and do a string search for localhost
  4. Find the string you need to replace, usually http://localhost/your-site depending on how you’ve setup your local server.
  5. Do a global string replace using the replacement string you found and replace it with your new domain, something like http://your-domain.com
  6. Save in UTF-8 format. You might want to save as a new file just in case you need to revert.
  7. Using phpMyAdmin on your destination web server create a database and import the new .sql file. With some cPanel hosts like Bluehost it’s easier to create using cPanel’s tools then edit in phpMyAdmin for importing the file. If all is okay you should now have your database setup.
  8. Using FileZilla (or equivalent FTP program) upload your website’s files to the web server.
  9. While the upload is happening, it’s time to create the wp-config.php file for your production instance, make a copy of the existing wp-config.php file in your WP root directory.
  10. Open and change the database value to the name of your web server’s database for your site. Also, change the username and password for the database as required.
  11. Save this as wp-config.production.php and upload to your web server.
  12. Once all uploading is complete, using FileZilla rename the existing wp-config.php file on your web server to wp-config.development.php and also rename wp-config.production.php to wp-config.php. Your new config file is now in effect.
  13. Before you get all happy and try to visit your website you need to login to the WordPress admin and navigate to the Permalink settings. Once there just click the save button (don’t change anything, just re-save it). This resets the permalinks to your new URLs so the links to pages and posts will work throughout your site.

 

In the next post i will explain how to upload from one server to another server.

 

And that’s all folks!