WordPress droplet - locked out of wp-admin page

July 30, 2019 196 views
WordPress Apache DigitalOcean Control Panels Getting Started One-Click Install Apps

I have a DigitalOcean droplet for WordPress. I set up my website, but then went into General Settings and changed the Site Address URL and immediately became locked out completely. All I can see is the error 404 message every time I try to reach my admin page.
I've seen online there are suggestions to update the wp-config file with the following:
define('WPHOME','example.com');
define('WP
SITEURL','example.com');
However, I do not know how to even access this wp-config. I am very new to all of this, so if anyone has any step-by-step instructions that would really help!

2 Answers

Hello Rane,

Indeed adding the lines in your wp-config is one way to fix that. The other ways is to connect to your database and in your wp_options table to adjust the values for your Site and Home URLs directly.

So in order to edit the wp-config.php file first you need to connect to your server, here's how to do that:

https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/

If you are using Windows you can follow this guide here:

https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/putty/

For Mac and Linux you could follow this one here:

https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/openssh/

Once you've connected to your droplet you can browse through your filesystem as normal. Your website files should be at /var/www/ so what you could do is run these commands here:

  • Go in to that directory:
cd /var/www/
  • Then list the content of the directoru:
ls -lah 
  • You should see either the name of your domain or a folder called www. Then just cd into that folder:
cd www
  • Then list the content again:
ls -lah

There you should see all of your Wordpress files, you can use your favorite editor and edit the wp-config.php file:

nano wp-config.php
  • And there just add the WPHOME and the WPSITEURL lines.
  • Clear the cache of your browser and try accessing the site again.

Hope that this helps!
Let me know how it goes.
Bobby

Hi Bobby!
Thanks for the easy to follow steps. I followed all these and now my site is up and looks normal again (before, it looked as though the theme was entirely missing and nothing was displaying properly).
However, I'm still not able to access the /wp-admin page. It seems to be redirecting me and gives me a 404 Not Found Error.
Do you have any ideas on why I may not be able to access my login?
Thanks so much for your time!! I really appreciate it.

I tried to post a reply earlier but it seems to not have gone through. Sorry if this is reposted twice.

Have another answer? Share your knowledge.