简体   繁体   English

Wordpress本地管理员重定向到实时服务器管理员页面

[英]Wordpress local admin redirects to live server admin page

Just transfer my live server wordpress website. 只需转移我的实时服务器wordpress网站即可。 Everything wprks fine when i realize that the locally localhost/site/wp-admin is redirecting in the live one. 当我意识到本地localhost / site / wp-admin正在实时重定向时,一切都很好。

And i can't access locally website. 而且我无法访问本地网站。

What should i do to fix this, and work locally to do some experiments? 我应该怎么做才能解决此问题,并在本地进行一些实验?

Thats the sql commands i put after transferring database locally 那是我在本地传输数据库后输入的sql命令

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

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

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

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

I use the following in wp-config.php to fix this: 我在wp-config.php中使用以下命令解决此问题:

define('DOMAIN_ROOT', 'http://localhost/site');
define('WP_HOME', DOMAIN_ROOT);
define('WP_SITEURL', DOMAIN_ROOT);

Use this script: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ to replace all occurrences of your live website url with the ones for the local website. 使用此脚本: https : //interconnectit.com/products/search-and-replace-for-wordpress-databases/ ,将所有出现的实时网站URL替换为本地网站的URL。

It will also apply the replace on serialized data in the db, so everything should be fine after doing this. 它还将对数据库中的序列化数据应用替换,因此执行此操作后一切都将正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM