DEV Community

Jeff Chavez
Jeff Chavez

Posted on

How to fix domain change error

Have you ever tried updating you website domain name then got an issue where the domain name is changed but you cannot log-in on your website? For example, you're changing your website domain name in the WordPress general settings from www.yourdev.com to www.yourdeveloper.com. The site domain has been changed but you cannot access it and all that you are seeing is the sample image below:
image
Today, we'll learn how to retrieve your domain name after changing it in WordPress general settings. Note that this does not require database or PHP knowledge, and I am indebted to Webdev Maestro for this resolution.

  1. Log-in to your website CPanel. Capture
  2. Then go to the file manager under files section. image
  3. Next is to find the wp-config.php file in the main page of your public manager. If it is not there, you can find it in the public_html folder. image
  4. Right click on the wp-config.php file, then hit view. Then locate define DB Name and take note of the particular name. 2
  5. Next, go back to your your CPanel and under databases click phpMyAdmin. image
  6. On the side bar, click on the plus "+" sign beside the name of the database that you have taken note earlier on the wp-config.php to collapse the options. image
  7. Then click on the name of your databases suffixed with "_options". image
  8. You'll see that the siteurl and home have the domain name that you are changing your domain to which also gives you an error. Now, our goal is to change siteurl and home variables. image
  9. Click on the pencil icon on the left to edit each variables. image
  10. Then you'll get to the next page so that you can change the website URL to the old one. Make sure that you are updating it to the initial domain name that you have before changing it. image
  11. Make sure on the options down the page you have the settings below (save and then go back to previous page): image
  12. Do the same for the home variable. If you can't find it on the first page then go to the next. image
  13. Once done, close the current tab, then go to the initial domain name and there you go, you'll have it back. Congratulations! You are able to retrieve your website and domain.

Do you have the same issue?
Let me know what other fix resolution you have for this error.

Discussion (2)

Collapse
djrasmusp profile image
Rasmus P

you could also add define('WP_HOME', your_url) and define('WP_SITEURL', your_url).. instead of doing it though the database, as these two parameters will overwrite the ones in the database

Collapse
jctechdev profile image
Jeff Chavez Author

Thank you