0

I have developed my wordpress site locally and now it's live on a host. Everything is working fine, but when I click the Home button on the top menu it goes to localhost/wordpress, not to my exact homepage.. Help me fix this.

3
  • you need to edit your database for references to the old (localhost) site and change them to the live url
    – rudtek
    Feb 27, 2019 at 17:21
  • Could you please explain me how to do it.. which data i should change Feb 27, 2019 at 17:22
  • Added how I do it as an answer.
    – rudtek
    Feb 27, 2019 at 18:42

2 Answers 2

0

You need to go into your new database and change the site url and home url to the new address. I suggest NOT doing this through phpmyadmin or the WP dashboard (using plugins) though as it will cause some problems. Plugins May work, but if wordpress hangs or times out or any number of things you could have a bigger problem.

I recommend is using Search & Replace DB, a free tool by Interconnect, to replace any instances of the host name in the database. It will handle setting the serialized data correctly for you. and it works OUTSIDE of the WordPress system.

First make sure that your wp-config is for the right database.

Go get this tool: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Upload it into your www/ folder. (I usually rename the search and replace folder to SRDB.)

Now navigate to your site with the SRDB at the end on the NEW url. (www.example.com/SRDB) and the top two lines you'll see a search field and a replace field. (if you get a db connection error here, double check the wp-config to ensure that it has the right credentials).

In the search field, place your old site address.

In the replace field, place your new url.

Hit live run.

ONLY do this after ensuring you're on your new url and that SRDB has loaded into your new database.

Remove the SRDB folder when you are done.

0

probably is a database migration problem: inside your database table wp_options there are two options, home and siteurl, which in your case must have set as value the "real" homepage in your website.

To complete the migration you should run a search and replace on the whole database, after fixing the options table, to find every url using the old localhost address. Use this plugin to do it.

1
  • Does this plugin handle serialized data? Looking on their support forum i see several issues people are having...
    – rudtek
    Feb 27, 2019 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.