How to Upload WordPress localhost to live server manually

In this post, we are going to upload a WordPress localhost blog to live server manually without breaking serialized strings in the database.

In the past I would use a text editor to search and replace the old URL to the new URL, but I recently learn that WordPress uses serialized strings of PHP in its database.

So according to the codex page, we should use the Search and Replace Database script, so we don’t break our WordPress website in the future.

Before we go to the steps, I installed the localhost blog on the Mac with this MAMP tutorial, and if you use Windows OS, you can use WAMP as shown in this tut.

If you prefer to use a plugin:

Here are the manual steps:

Replace blogweb6move to your local WP site’s folder.

1. Download the search and replace script from this website.

I saved it on my desktop.

2. Open your website directory on your computer, because I use MAMP, I saved it on “blogweb6move” folder inside “htdocs” directory.

If you use WAMP server, it should be on “www” folder.

I compressed all WP files inside “blogweb6move” folder to be an blogweb6move-files.zip.

Localhost WordPress files are compressed to a zip file

Localhost WordPress files are compressed to a zip file

I am using The Unarchiver app to compress.

3. Next, we are going to import the localhost’s database, so go to localhost/MAMP in your browser, and click on “phpMyAdmin” tab. Select your database, if you are not sure which one, you can look at the “blogweb6move” wp-config.php

Related: How to Install WordPress on Mac Lion OS X and MAMP

Once you’re in the right database, click on “Check All” and click “Export” from drop down menu.

Importing localhost database

Importing localhost database

4. Once we have the database .sql file, the WP site files, and the search and replace DB script, we go to our cPanel and create;

a. A new database

Creating a new database

Creating a new database

b. A new database username

New user for database

New user for database

c. Add database username to the database.

Add user to the database

Add user to the database

5. We go to File Manager, to our website’s root, and upload the database script, and our WP files here.

Uploaded files, localhost WP files, and the search replace database scripts.

Uploaded files, localhost WP files, and the search replace database scripts.

Then we extract the Search and Replace DB script first, and rename the folder to be shorter, like “srdb”, by selecting the file, and right click, select, “Rename”.

Renaming the script.

Renaming the script.

Delete the Search-Replace-DB-master.zip file once it’s extracted.

Extract our blogweb6move-files.zip, and delete the.zip file once it’s extracted.

6. Next, we import our localhost database to our server’s new database via phpMyAdmin. So go to your phpMyAdmin, and select the new database on “Database” tab, and click “import” tab, and choose “Browse your computer” – click “Choose File” button, and navigate to our localhost .sql file in our desktop, and click “Open”

Importing localhost database to server's database

Importing localhost database to server’s database

Scroll down, click “Go” button to import.

7. Then, we update the wp-config.php to match the new database we created on step (4) above with our new database’s name, new Username, and new database’s password.

Updating wp-config.php

Updating wp-config.php

It’s optional, but I recommend you updating the new secret key.

Save the wp-config.php

8. Now, the interesting step (new method is always interesting to me), add /srdb in your domain name in the browser, it should load the Search Replace DB script we downloaded in the step 1 above.

Search and Replace database for WordPress

Search and Replace database for WordPress

In the replace box: enter your localhost URL, mine is, http://localhost/blogweb6move (without forward slash)

Then in “with” box, enter your live domain, mine, http://wphowtosite.com (also no forward slash, it has to match with the localhost URL)

Click “dry run” to see which tables will be changed or updated.

Then, you can click “live run” to perform the search and replace process.

9. Now if you check your live site, you might find, error page when you click one of your post or page. Login to your dashboard, and click “Save Changes” in “General” and “Permalinks” setting.

10. This is VERY important step, you have to delete the script manually, since we rename the folder earlier.

Go to your cPanel, and select the “srdb” folder, and click “Delete” button.

I hope this helps.

Share the knowledge
Share on Google+0Tweet about this on TwitterShare on Facebook1Pin on Pinterest0Share on Reddit0Email this to someonePrint this page