开发WordPress管理员链接重定向到实时站点 [英] Development WordPress admin link redirecting to live site
问题描述
我正在尝试对我拥有的WordPress网站进行新更改.因此,我复制了所有文件并导出到新的开发子域.为子域创建新数据库,并从实时站点导入数据库.
I'm trying to make new changes to a WordPress site I have. So I copied all files and exported to new development sub-domain. Made new database for the sub-domain and imported the database from live site.
实时网站: http://mysite.com
开发站点: http://dev.mysite.com
似乎可以正常使用,但所有导航链接仍指向实际站点.而主要问题是当我转到 http://dev.mysite.com/wp-admin 时,我被重定向到实时站点.这是我要重定向到的链接:
Seems to be working, but all nav links still point to live site. And main issue is when I go to http://dev.mysite.com/wp-admin, I get redirected to live site. This is link I'm getting redirected to:
谢谢
推荐答案
上面的答案是正确的,大多数情况下,在wp_options表中编辑"home"和"site" URL可以解决问题,但是有时有必要在数据库上进行搜索和替换(使用后果自负):
The answers above are correct, most of the time editing the 'home' and 'site' url in the wp_options table will do the trick, however sometimes it's necessary to run a search and replace on the database (use at your own risk):
https://interconnectit.com/products/search-and -replace-for-wordpress-databases/
过去,这对我来说非常有效.
This has worked very well for me in the past.
此外,通过转到设置"->永久链接"并仅单击保存"来更新永久链接设置通常会解决网址问题.
Also, updating your permalink settings by going to Settings->Permalinks and just clicking 'Save' will often fix url problems.
编辑
或者,由于您无权访问wp-admin来更新永久链接,因此您可以尝试以下操作:
Alternatively, since you do not have access to wp-admin for updating permalinks, you can try this:
编辑wp-config.php
并添加以下内容:
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
其中 http://example.com 是您的网站网址.
紧接在就这样,停止编辑!"之后插入此行:
Directly after "That's all, stop editing!" insert this line:
define('RELOCATE',true);
然后,导航至 http://example.com/wp-login.php
请让我知道是否可行.
这篇关于开发WordPress管理员链接重定向到实时站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!