I changed my live WordPress site URL from https://mywebsite.com to localhost/myproject just for testing purpose. But Now I am unable to login to my website again because after I login, it redirects me to https://localhost/myproject/wp-login.php. and there's the error This site can’t be reached localhost refused to connect.

How can I change the URL back to normal?

  • If u can access the data base from there you can change the site url and home url in wp_options – DHL17 Jan 22 '18 at 4:50
  • That's ok, I'm done!. I add these lines to functions.php "update_option('siteurl','mywebsite.com'); update_option('home','mywebsite.com');" – shiba Jan 22 '18 at 4:51

Try this

First method is

Add the above code in wp-config.php


Second method is

Comment Plugins one by one and check.

After successfully login update permalink.

  • Hello, I've done. Thank you. I add these lines to functions.php "update_option('siteurl','mywebsite.com'); update_option('home','mywebsite.com');" and update the permalink – shiba Jan 22 '18 at 5:16
  • But thank you for pointing out update permalink. – shiba Jan 22 '18 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.