简体   繁体   English

移至根域后无法访问WordPress管理员

[英]Unable to Access WordPress admin after moving to root domain

I have a website launch on sub domain ( sub.domain.com ) and all working fine there. 我在子域( sub.domain.com )上启动了一个网站,并且在那里一切正常。 I transferred it to root address ( domain.com ) by following steps. 我通过以下步骤将其转移到了根地址( domain.com )。

  1. Downloaded all the file contents from sub domain directory. 从子域目录下载了所有文件内容。
  2. Uploaded all those content to root directory. 将所有这些内容上载到根目录。
  3. Downloaded db script of the sub.domain.com install of WordPress. WordPress的sub.domain.com安装的已下载数据库脚本。
  4. Replaced all addresses from sub.domain.com to domain.com by notepad 用记事本将所有从sub.domain.com地址替换为domain.com
  5. Uploaded this script as new DB and added credentials in wp-config.php of root domain's WordPress. 将此脚本上载为新数据库,并在根域的WordPress的wp-config.php中添加了凭据。

The issue now I am facing is that it when I try to access the /wp-admin of new root domain's WordPress it doesnot accept them. 我现在面临的问题是,当我尝试访问新的根域的WordPress的/wp-admin ,它不接受它们。

I created a admin user directly into db from this site , but it also is not working. 直接从此站点向db创建了一个管理员用户,但它也无法正常工作。

Whenever you move a WordPress site, you need to properly adjust configurations in your WordPress install in the wp-config.php file on the following variables: 每当您移动WordPress网站时,都需要在以下变量的wp-config.php文件中正确调整WordPress安装中的配置:

define('WP_SITEURL', 'http://domain.com/wordpress');
define('WP_HOME', 'http://domain.com/');
define('WP_CONTENT_DIR', '/path/to/your/wordpress/wp-content');
define('WP_CONTENT_URL', 'http://domain.com/wp-content');

This will force your install to use the domain.com URLs. 这将强制您的安装使用domain.com URL。 Also, when you do this the first time set the RELOCATE setting to true like this: 另外,第一次执行此操作时,将RELOCATE设置设置为true如下所示:

define('RELOCATE', true);

That basically tells WordPress to rejigger (that's my technical term for it) it's stored settings for the new settings. 这基本上告诉WordPress重新启动(这是我的技术术语),它存储了新设置的设置。 And after you have reloaded your site & it works as expected, set RELOCATE setting back to false like this: 重新加载网站并按预期工作后,将RELOCATE设置重新设置为false如下所示:

define('RELOCATE', false);

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

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