Wordpress已部署到主机服务器,但页面仍尝试访问localhost URL

So I developped everything locally.

When I uploaded it to the actuall hostserver under http://lukasmeier.someurl.ch I still get calls to localhost.

Which setting do I have to manipulate?

I added to wp-config.php

define('WP_HOME','http://lukasmeier.example.com/demoapps');

define('WP_SITEURL','http://lukasmeier.example.com/demoapps');

enter image description here

Wordpress stocks URL information in the DB, be sure to proceed to Search and replace on a dump of your current DB and replace the URLs (ex: http://localhost.com/site > http://www.site.com DON'T INCLUDE THE LAST SLASH ) , then reupload the dump on your server.

OR

Here's a PHP script that do the job : https://github.com/interconnectit/Search-Replace-DB

I use that two ways, it works fine.

Edit:

  • go to your admin, Appearance > Menus and save it (if you have one)
  • regenerate the permalinks

You need to update two values in the wp_options table of your database.

I think that the values correspond to Base url and Home url, but most probably you will find them if you filter the table for localhost as this string is probably in there ;)

Regardless of changing config, wordpress stores this in options. In it's mysql database, you'll find a table called wp_options and there's column option_name called siteurl.

Source & more info here.