newday
newday

Reputation: 3878

wordpress Live site redirect to localhost

I have develop a site (word press) locally and move it in to a remote server. Everything seems fine except when I click the home link it redirect to my localhost website.

To fix this what I did was, Changed the site url and home url to web url without adding the slash after the url.

Apart from that I added the following code to wp_config.php

define('WP_HOME', 'http://mysite.com');
define('WP_SITEURL', 'http://mysite.com');

But when click the home button it still redirect in to the localsite.

I have changed wp_option table also

Upvotes: 2

Views: 17202

Answers (6)

Paul McCarthy
Paul McCarthy

Reputation: 890

I would guess that 99% of web developers work on localhost and then deploy to somewhere that is obviously NOT localhost. It really annoys be that this sort of error happens. How much time is wasted by not having a live vs dev setting for this? Mine is still insisting on going to localhost. I'm going to have to search my HDD for the word localhost at this stage Finally found it under General Settings - Site Address URL which does not correspond to what is in wp_options.

Upvotes: 0

Sun
Sun

Reputation: 173

Changing wp_options table worked. Had to make sure to clear cache.

Upvotes: 0

Bhumi Shah
Bhumi Shah

Reputation: 9476

you need to change url into database too

UPDATE wp_options SET option_value = replace (option_value , 'http://www.oldsite.com' , 
      'http://www.newsite.com')         
   WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace 
   (guid , 'http://www.oldsite.com' , 'http://www.newsite.com');

UPDATE wp_posts SET post_content = replace 
       (post_content , 'http://www.oldsite.com' , 'http://www.newsite.com');


UPDATE wp_postmeta SET meta_value = replace 
    (meta_value , 'http://www.oldsite.com' , 'http://www.newsite.com');

Upvotes: 10

StreetCoder
StreetCoder

Reputation: 10061

Update wp_options table in database for siteurl and home. In the table first row is siteurl and 36th row is home.

Upvotes: 0

newday
newday

Reputation: 3878

I had to update the url given in menu navigation for Home button.

Upvotes: 2

Reshma D
Reshma D

Reputation: 59

In wp_options table change siteurl option value to your live site url. If still problem exists search 'localhost' in your db and replace it with live site url.

Upvotes: 0

Related Questions