How to fix domain change error
Tags: wordpress, webdev
Published: 2021-07-22 04:47:28

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz0f3bssd5lntfrty6lx.png)
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](https://www.youtube.com/watch?v=KzhFJAXj2yA&t=176s) for this resolution.
 
1. Log-in to your website **CPanel**.
![Capture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b192evrzncxes3izupps.PNG)
2. Then go to the *file manager* under **files** section.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5tdx774k8qysp15dk0b3.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41nqby64u3n43ob6vlld.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9lje3ei5vpxqcngs6740.PNG)
5. Next, go back to your your **CPanel** and under *databases* click phpMyAdmin.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhb7mq9ibf9nw5ulsj3p.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1y612nt14btvqi66odx.png)
7.  Then click on the name of your databases suffixed with **"_options"**.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dl7b16gkif0u88furdu5.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50vogh2fq7pcfmq8dxjx.png)
9. Click on the *pencil* icon on the left to edit each variables. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pp839sw6fuflupn1o5b8.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbz76r3g4yx8k3zc5fa8.png)
11. Make sure on the options down the page you have the settings below (save and then go back to previous page):
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4v76cuaicdvmsybae108.png)
12. Do the same for the *home* variable. If you can't find it on the first page then go to the next. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hhn7wggzbjv58hizqm9r.png)
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.