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.
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.
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
Once you’re in the right database, click on “Check All” and click “Export” from drop down menu.
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
b. A new database username
c. Add database username to the database.
5. We go to File Manager, to our website’s root, and upload the database script, and our WP files here.
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”.
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”
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.
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.
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.