WordPress在迁移后重定向到旧登录

时间:2017-03-13 作者:smashingtuck

我已经完成了将现有wordpress站点迁移到另一台服务器的所有步骤。然而,当我尝试登录到迁移的站点时,它会不断将我重定向到旧站点,不管我是否使用wp admin。php或wp登录。php。

我还阅读了十几个关于迁移worpress帐户的不同页面,但没有一个遇到我在某些步骤中遇到的问题。

以下是我遵循的步骤,包括我遇到的与迁移说明中指定的步骤的差异(以粗体突出显示的问题):

1) 使用ftp将所有wordpress文件从oldsite下载到我的硬盘。

2) 使用PHP myadmin从我的旧站点下载了数据库。

3) 使用ftp将所有wordpress文件上载到我的新闻网站上的选定目录。

4) 使用PHP Myadmin在新闻网站上创建了一个新数据库。As I am loading onto a different server, I created a new database using the same database name and password from the oldsite. That way I didn\'t have to change the WPconfig file. Is that okay to do? Not a single migration article I read used the same database and password, nor did they say not to, so I assumed it would be okay.

5) 使用phpMyadmin将wp\\u选项中的数据库条目更改为新URL。However, every instruction I read says there are two fields to change: siteurl and home. There is no home field in my wp-options. Just siteurl.

6) 我在phpMyadmin中使用输入到SQL中的以下字符串成功地将所有旧站点url更改为新闻站点url:

更新wp\\u posts set post\\u content=替换(post\\u content,\'http://oldsite/\',\'http://newsite/\');

对所有这些数据库表执行了相同的操作:

wp\\u postswp\\u redirection\\u logswp\\u userswp\\u redirection\\u项目

我检查了每个表,所有的更改都很好。

7) 检查每个数据库表以确保没有旧站点URL的实例。找不到。

8) 在浏览器中输入新闻站点URL。I get a 404 message. The menu, latest postings and banner all appear okay, but if I hover over any of them they are all pointing to the oldsite URLs.

9)When I try to get into the admin panel of the newsite, it allows me to enter the name and password, then automatically redirects me to the oldsite and asks me to login again. Tried on different browsers but the results are always the same.

知道我做错了什么吗?

2 个回复
最合适的回答,由SO网友:ferdouswp 整理而成

尝试在中添加以下两行wp-config.php 文件:

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

SO网友:rudtek

首先确保您的wp配置文件连接到正确的数据库。

你需要进入你的新数据库,将网站url和主页url(这肯定是你在这里遗漏的问题)更改为新地址。但我建议不要通过phpmyadmin这样做,因为这会导致一些问题。

获取此工具:https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

将其上载到您的www/文件夹中。(我通常将搜索和替换文件夹重命名为SRDB。)

现在导航到您的站点,最后是SRDB。(www.example.com/SRDB)和顶部的两行,您将看到一个搜索字段和一个替换字段。(如果此处出现db连接错误,请仔细检查wp配置以确保其具有正确的凭据)。在搜索中放置您的旧网站地址

在替换字段中放置新url

点击live live run。

只有在确保位于新url上并已将其加载到新数据库中后,才能执行此操作。

这应该可以解决你的问题!

将来使用此工具时,也不必进行phpmyadmin搜索。

相关推荐

无法在模板函数.php中使用IS_HOME

我试图在标题中加载一个滑块,但只在主页上加载。如果有帮助的话,我正在使用Ultralight模板。我正在尝试(在template functions.php中)执行以下操作:<?php if ( is_page( \'home\' ) ) : ?> dynamic_sidebar( \'Homepage Widget\' ); <?php endif; ?> 但这行不通。现在,通过快速的google,我似乎需要将请