Cant login to my wp-admin after switching to SSL Cant login to my wp-admin after switching to SSL wordpress wordpress

Cant login to my wp-admin after switching to SSL


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.

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.


It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.

define('WP_HOME','https://example.com');define('WP_SITEURL','https://example.com');

For more refer here

or check in table wp_options column option_name = siteurl check the option_value


You need to change the site url in wp-admin->Settings->General. Except now you need to go in through phpMyAdmin and do it manually in the wp_options table since you are locked out.

You get different cookies depending on http/https so you are getting the https cookie and then being redirected to http that has no cookie because of your Wordpress settings that say what url the site resides at.