简体   繁体   中英

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. I transferred it to root address ( domain.com ) by following steps.

  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.
  4. Replaced all addresses from sub.domain.com to domain.com by notepad
  5. Uploaded this script as new DB and added credentials in wp-config.php of root domain's WordPress.

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.

I created a admin user directly into db from this site , but it also is not working.

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:

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. Also, when you do this the first time set the RELOCATE setting to true like this:

define('RELOCATE', true);

That basically tells WordPress to rejigger (that's my technical term for it) it's stored settings for the new settings. And after you have reloaded your site & it works as expected, set RELOCATE setting back to false like this:

define('RELOCATE', false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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