Unable to access wp-admin after SSL added - too many redirects

redirects

#1

I’ve added cloudflare SSL to my site and it all appeared to be OK.
Then I made a mistake - I went into my WP general settings and changed the URL for the site to httpS instead of http, and then I couldn’t access the site - too many redirects.

I was able to get the site back up by correcting the URL in wp-config

define('WP_HOME','http://motorhomeeurope.com');
define('WP_SITEURL','http://motorhomeeurope.com');

So now the site loads just fine for visitors. Except I cannot access the wp-admin, I still get the redirect error.

I have the SSL set to flexible, have always use HTTPS set, and have a page rule which says http://motorhomeeurope.com/* always use https
The support files for Cloudflare suggest using various plugins to correct redirect loops, but I can’t get into my dashboard to even add one.
Any suggestions please - I’m a complete newbie so I’m going to need a lot of help to sort this out! Sorry!


#2

You might try a page rule for:
*.yourdomain.com/wp-admin with:
Disable Security
Cache Level: bypass
Disable performance

This explains why you get the error:

Also specifically about using Flexible with WordPress:

Are you able to install a certificate on the server so you can set it to full rather than flexible?

You could also have a read of this:


#3

Also make sure you don’t force SSL for admin. Set to False.
https://codex.wordpress.org/Administration_Over_SSL


#4

Thanks for the suggestion. I set up the suggested page rule and it didn’t help.
I don’t know about installing a certificate on the server, don’t know how I do that.

Should I just try turning off the SSL in cloudflare and see if that fixes it?


#5

I looked in my wp-config and I don’t have that anywhere. The define(‘FORCE_SSL_ADMIN’, true);

Should I add it then and set it as

define(‘FORCE_SSL_ADMIN’, false);


#6

If you disable the SSL in Cloudflare then you should be able to login but it will also disable the SSL for visitors…

You could try disabling it, logging in and then editing the settings / installing the plugin you mentioned earlier and re-enabling it again.

Someone here may be able to help, is is cPanel or what access do you have to a control panel via your host?

You could try adding that line, yes. I have never fixed it that way though… @sdayman?


#7

Oh dear, that made it even worse. I disabled the SSL by turning the setting to Off, and now I can’t get into anything. Even the website now has a redirect error.

If I turn it back on again to flexible, I can get all the pages on the site except the home page, which still has the redirect error, and so does wp-admin.
I think I’m just going to give up.
All this is far beyond what I can understand.
I’ll just start again from my server I think and reinstall wordpress and build the site again without SSL.
What a shame, it should be so easy!


#8

Setting it to false is worth a try, but if it’s not set to true, it’s not likely the problem. Something else is redirecting.


#10

You don’t need any plugin, they would slow down the site for nothing, just add this in wp-config.php:

$_SERVER['HTTPS'] = 'on';

(this is the simplest way. The wp-config file isn’t changed with updates so you’re safe)

It works because it’s the first variable checked by the is_ssl() function: https://developer.wordpress.org/reference/functions/is_ssl/


#11

I found a similar issue with some suggestions. One that suggests setting that SSL Admin variable to True. Can’t test at the moment, but here’s the thread:

Let us know how it goes.


closed #12

This topic was automatically closed after 31 days. New replies are no longer allowed.