How to Fix SSL Error When You Can’t Login to WordPress

Errors and problems are something that we all face them sooner or later. However, these errors should not prevent us from trying or experimenting with something new. One of the strange issue that many users face is that when trying to login to WordPress, an SSL error is occurred. In this post, you’re going to learn how to fix SSL error when you’re unable to login to WordPress admin (or Dashboard).

So let’s take a look at all these SSL related problems in WordPress, along with their solutions.

SSL certificate

Have you recently activated SSL certificate on your site and are unable to login to WordPress? In such a case, ensure that you’ve correctly configured SSL certificate and settings related to it. Improperly configured SSL certificate may cause login issues.

Edit your wp-config.php file

Some users make changes in: Settings > General, and update WordPress Address (URL) and Site Address (URL) from there. By mistake, you might have added HTTPS to the URL. For example; https://yoursite.com instead of http://yoursite.com

wp-url

If you’ve made these changes, then you won’t be able to login to WordPress. That’s why, you’ll now need to use a FTP client like Filezilla, or use your cPanel’s File Manager and edit your wp-config.php manually. Add these lines to your wp-config.php

define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);

Add these lines just before:

/* That’s all, stop editing! Happy blogging. */

Also replace example.com with your own domain name.

Check your .htaccess file

In your site’s root directory, such as domain.com/public_html, you’ll find a file named as .htaccess. In some cases, it might be hidden and you’ll need to checkmark “view hidden files” in the cPanel’s File Manager.

Ensure that your .htaccess looks like below:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

If it doesn’t looks like this, then edit it and make the required changes.

Forcing HTTPS login in WordPress

Have you recently made any changes to the wp-config.php file to force HTTPS on the login page of WordPress.

define(‘FORCE_SSL_LOGIN’, true);
define(‘FORCE_SSL_ADMIN’, true);

If you’ve added any of the above constant in the wp-config.php file, then remove it from there.

Disable all plugins

Some security plugins such as iThemes Security (previously known as Better WP Security) have an option to force SSL on your site for only admin page, and for all pages or posts. If you’ve checkmarked this option in the plugin’s page, and if your server doesn’t supports SSL, then you won’t be able to login to WordPress because of SSL error. What now?

That’s where you’ll need to deactivate all plugins, or you can also rename one plugin at a time to see if that has solved your problem. Renaming the plugin will instantly deactivate the plugin, and that’s why problems arising out of that plugin will be fixed.

To disable all plugins at once, use FTP client or your host’s File Manager and navigate to wp-content folder. Rename the “plugins” folder to “plugins.hold”. This will deactivate all plugins instantly. If you’re now able to login then it means that a plugin is the culprit, and in such a case you’ll need to find that plugin and remove it.

Edit your WP_Options table

From your cPanel, login to your phpMyAdmin, go to your WP_Options table where you will find your site URL and home URL starting with HTTPS. You just need to edit it back to HTTP (by removing the “S”).

So go ahead and follow these methods when you’re getting SSL error on login page of WordPress. Hopefully these tips should be able to help you solve your problem.

Note: To help you fix your everyday WordPress problems and errors, we’ve also started a new WordPress troubleshooting section.

19 thoughts on “How to Fix SSL Error When You Can’t Login to WordPress”

  1. hi, i added to wp-config.php…
    define(‘WP_HOME’,’http://example.com’);
    define(‘WP_SITEURL’,’http://example.com’);

    and it gives a blank white page.

    any idea whats wrong?

  2. The best way to solve this issue is by logging into your phpmyadmin in your cpanel the go to the table wp_options , the there you will see your site url and home url starting with https, just edit it and change that back to http .
    It will 100% resolve your issue.

    Thanks

    1. Hey Rizwan Mirza, You made my day…Thank you so much…when nothing worked, you made it so easy.
      @Saqib, I request you to include this info (provided by Rizwan) in your post…it will really help others in need.

    2. The best way to solve this issue is by logging into your phpmyadmin in your cpanel the go to the table wp_options , the there you will see your site url and home url starting with https, just edit it and change that back to http .
      It will 100% resolve your issue.

      Tried it, didn’t work unfortunately 🙁

  3. The problem could also be related to your host’s setup, and it may need a different solution.

    I had the exact same problem with my site on NearlyFreeSpeech.net, and the solution was not so simple as fixing the site URLs. That made no difference.

    The underlying problem in my case, and the solution, were explained in the post copied below. Note that on my system, the SSL error created two problems, the one described here on Stack Overflow (wp-login refreshes without logging in) and a failure of WP to load stylesheets, which was the problem actually addressed in the forum post quoted below. The solution in the post solves both problems.

    ————————— QUOTED FROM ANOTHER POSTER ——————————-
    What you describe sounds like the browser refusing to load the stylesheet, which typically happens when first creating an HTTPS-enabled WordPress site or adding SSL/TLS to an existing WP site.

    WordPress isn’t very smart about “reverse proxies” like what NFSN uses, where the user hits an outer web server that then talks to an inner application server where WordPress actually lives.

    If you think you have an SSL-enabled site, especially if it’s a new one, this could be your problem. You would need to edit your wp-config.php file to add the following:

    if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’)
    $_SERVER[‘HTTPS’]=’on’;

    just above the “That’s all, stop editing! Happy blogging!” lines.

    Conversely, if you don’t think you are using SSL on your site, this won’t do anything. Check the alias for your site on the NFSN site control panel. If you see a padlock, you’re set up in NFSN and need the code above.

    WordPress’s implementation of SSL is kind of a botch. It not only doesn’t recognize SSL under environments like ours – it also is prone to redirect loops if everything isn’t changed in exactly the right order. If the code above causes a site outage – you keep getting complaints from the browser about redirect loops – then remove the code and ask again. I’ll see if I can find my notes about how to do initial SSL setup.

  4. Hey guys, I must CORRECT the ABOVE LINES are WRONG…inaccurately quoted.

    define( ‘WP_HOME’, ‘http://example.com/wordpress’ );

    THIS is how you correctly write it. Got this from the wordpress wiki and it has more spaces and different `””““ icons as you can see when you compare.
    So after finding this post not working, I went to endless other pages and copied from there and it worked by inserting the correct FORM!
    Thanks anyway for the detailed solution.

  5. Rizwan Mirza wrote…
    The best way to solve this issue is by logging into your phpmyadmin in your cpanel the go to the table wp_options , the there you will see your site url and home url starting with https, just edit it and change that back to http .
    It will 100% resolve your issue.
    —–
    Thank You Rizwan! Such an easy fix – you saved me a lot of time.

  6. define( ‘WP_SITEURL’, ‘http://example.com/’ );
    define( ‘WP_HOME’, ‘http://example.com/’ );

    this is the correct format!!!!! just slight change

Leave a Comment

Your email address will not be published. Required fields are marked *