Question

Can't login to wp-admin after changing http to https in the URL settings

I’m working on a project and my task was to setup the LetsEncrypt SSL cert, which I did. However, I then needed to redirect the http to https, which is where I screwed up. I changed the URL within wp-admin from http to https, and it broke the site, so now I can’t get back in. To make things better, I tried to SSH into the machine so I could try changing the config file, but the console doesn’t load. I also can’t seem to SSH into the device.

The droplets weren’t setup by me. They were setup by my professor.

Is there an easy way to fix this, or should I just revert to a backup and start over?

To clarify, I setup the SSL certificate through the DO security tab, not by installing anything onto the machine itself. I’ve been finding different documentation about needing something called Certbot? I can’t seem to find anything specific to my circumstances.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello there,

If you’ve already updated the Home and Site URLs from the WordPress admin panel then you can take the next step and update all the references for the IP address in your database as well.

**Note:**Please before you proceed take a snapshot of the droplet and also create a backup of the site (both files and database). This will ensure that if something goes wrong you can easily restore your site or droplet if needed

There are a few ways to update the references in your database and it’s totally up to you which one you’ll choose. You can either change them manually if they’re not many or use an automation tool like a plugin or an external app.

One of the external apps that I’ve used and I know for sure that it’s working okay is: https://interconnectit.com/products/search-and-replace-for-wordpress-

You need to upload the script in your public_html folder and access it in your browser, then you’ll need to fill in your database details and enter the old name (IP address) and the domain name you want to use. Then you can first use the dry-run option and if there are references that need to be updated you can then run the script and update them.

Also, an alternative way is to use a plugin called “Duplicator” it will update all of the paths and references from the dev domain to the main domain. This is why we usually recommend using a plugin called: Duplicator. The plugin will generate a backup for your website’s files and database. Then when you import the files to the new domain, all of the references for the old domain name will be updated properly with the correct ones.

Another option is to use the All-in-One WP Migration plugin. The plugin will do the replacement for you during import. You do not need to use any additional database search and replace

https://wordpress.org/plugins/all-in-one-wp-migration/

Once this is done you can check the site for any errors as there might be some hardcoded references for the IP address in the files like paths to directories, files and etc.

Hope this helps!

Hi @ashleycollins,

Don’t worry everything is fixable!

So, first, you need to get access to your Droplet back. There is a docs page on how you can do that using the recovery console:

https://docs.digitalocean.com/products/droplets/how-to/recovery/recovery-console/

From there you can get access to your Droplet and let’s say add your SSH key to it.

Now that you are inside, you first need to turn back the https to http connection. There are multiple ways to do that like updating the database directly from your console (which can be a little tricky), using WP-Cli to update the connection, and so on.

If you are not very familiar with MySQL/MariaDB, I’ll recommend using wp-cli. WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installations, and much more, without using a web browser. It’s really easy to install. You just need to go to the folder your WP installation is in and follow the instructions from here to install it:

https://wp-cli.org/

Once you have wp-cli installed you can try something like:

wp search-replace https://example.com http://example.com --all-tables

Here is a tutorial on how you can more easily use the wp-cli:

https://www.digitalocean.com/community/tutorials/how-to-use-wp-cli-v2-to-manage-your-wordpress-site-from-the-command-line

Okay, so that’s that. Now for cerbot. Here is a tutorial on how to use certbot:

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04

It’s really easy, you just install it and run it.