October 22, 2013

Uploading A WordPress Website From A Local To A Remote Installation

If you’re working on a local website for development and need to upload it either to go live or because you need to show a client or other team members your work, you’re going to need to upload your WordPress website. This is more complicated than moving from a sub-directory to the root directory, and involves moving three things:

  • WordPress itself — you’ll need to install this in the new location;
  • The database — which you can move using phpMyAdmin;
  • Your theme files, uploads and plugins.
1. Turn Off Permalinks

Turn off pretty permalinks in the “Permalinks” screen, which you’ll find in the “Settings” menu. Do this by selecting the “Default” option and clicking “Save Changes.”

2. Backup the Database

Make a copy of the database and give it a new name (for example, by adding “old” to its name).

3. Install WordPress In the New Location and Upload Content 

Using your preferred method, install WordPress on the server you want to move your website to.  Don't have a web-hoster?  We recommend Hostgator.com.  You will receive a 25% discount on sign-up. Please use Coupon Code: sublimemaxxus when you register for th service.

Using FTP or SFTP, copy the files from your local “wp-content” directory to the remote “wp-content” directory, using the same folder structure as in your local install.

Go and have a cup of coffee. These files could take a while to upload.

4. Edit the Database 

Don’t just open the original database file from your local installation and edit it. DB data stored serialized will break if edited directly in a text editor. You are better off with a serialize-aware tool like Search-Replace-DB. Replace the old, local URL for the website with the new, remote URL.

For example, if your local URL is http://localhost/example, you would change it to http://example.com.

Using the “replace” command will speed this up — there could be thousands of instances. Save your new database.

5. Drop the Existing Remote Database

Note: This step only applies if you’ve used a script such as Softaculous or Fantastico to install WordPress, as they automatically create a new database. If you’ve installed WordPress manually, you can ignore this bit.

In phpMyAdmin, drop (delete) the database that was installed in the remote website when you installed WordPress:
  • Select the database you’re working with.
  • Click on the “Structure” tab.
  • Below the list of tables, click “Check All.”
  • In the drop-down menu which says “With selected,” select “Drop”:


  • You will see a warning message checking that you want to drop all tables. Click “Yes.”
  • Finally you will see a message telling you that your query has been implemented:

6. Upload the New Database

While you are still in phpMyAdmin, upload the database you’ve edited:
  • Click the “Import” tab.
  • Click the “Choose file” button.
  • Select the database you saved in step 4 and click “Choose” or “OK.”
  • Click the “Go” button.
  • After a while (depending on the size of your database), you will see a message telling you the upload has successfully finished:


7. Clear Your Browser’s Cache

This avoids any problems you may have if the browser has cached content from the old version of the remote database.

8. Log Into the WordPress Admin For the Remote Website and Update Permalinks

Your log-in details will be the same as for your local website. If you specified different log-in details when installing remotely, these will have been overridden by the imported database.

Visit the “Permalinks” screen and turn pretty permalinks back on.

You’re done!

0 comments:

Post a Comment