WordPress solved problem unable to login on sub-domain, after domain name change

Recently while setting up Wordpress for my recipe site and custom sub domain for this site, I have faced these two problems
  1. Unable to login to my Wordpress after change in domain name change.
    • Before activating actual domain of my recipe site, I have used a temporary domain name to the site. But after activating to the main site, login page took me to the old address which does not exists. So I was not able to use wordpress.
  2. Unable to login, when I was trying to install wordpress on a sub domain.
    • I have created a sub domain(seorecipetool.techcollections.co) for the domain(www.techcollections.co) which I am hosting on Blogger. So I configured the name-servers accordingly and installed wordpress using GoDaddy's hosting automated installation. But the wordpres login failed because the wordpress installation is configured for the actual domain www.techcollections.co.

For both the problem, root cause and solution is same.

Root cause: 

During automated installation, the wordpress MySQL database is initialized with the old domain name. After update of domain or creation of sub domain, the database file is not updated. So after login, the login page(wordpress) will try to forward to the old domain name in the configuration file. This will cause the login to fail.

Fix:

  1. First for updating the wordpress MySQL it is necessary to know the database username and password.
  2. For that, go to wordpress installation folder using ftp access or hosting file manager and find the file wp-config.php and find the below lines.
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'xxxxx');

    /** MySQL database username */
    define('DB_USER', 'xxxxx');

    /** MySQL database password */
    define('DB_PASSWORD', 'xxxxx');
  3. Backup the MySQL Wordpress database.
  4. Now from hosting options open the MySQL database using the user name and password found above.
  5. In MySQL database look for options table.
  6. In options table there is field called URL.
  7. Correct the domain name here and save.
  8. Now you will be able to login to the wordpress.

No comments :

Post a Comment