Better solution to prevent Wordpress ERR_TOO_MANY_REDIRECTS (only appearing at wp-admin)?

Is there a way to prevent this error, ERR_TOO_MANY_REDIRECTS from appearing at /wp-admin after certain common installation conditions (described below). Here is what I did:

I pointed my DNS to Cloudflare.

Then on Cloudflare I created an A Record (@) pointing to my Digital Ocean droplet IP address, as well as a www CNAME Record aliased to that A (@) Record.

I set the SSL on Cloudflare to “Flexible” (and did not install SSL on my digital ocean droplet.)

I used the Wordpress One-Click installer to spin up a Wordpress site using the directions here:

Following the completion of the Wordpress install, I was getting ERR_TOO_MANY_REDIRECTS (but only when trying to log in at /wp-admin. The front of the site showed no errors).

In order to correct this error, I needed to change the WordPress Address (URL) and the Site Address (URL) at Settings - > General in the /wp-admin (backend) of the Wordpress site. However I couldn’t login to the admin of the Wordpress site in order to do this, due to the ERR_TOO_MANY_REDIRECTS error.

I’m an FTP user, so I used FileZilla to add the settings below to the file wp-config.php which corrected the problem and allowed me to log in at /wp-admin (hooray!)

In FileZilla, I right-clicked on remote file, then clicked View/Edit (I did it this way, because I found that if I downloaded, edited, and then re-uploaded the file it changed the “owner” of the file which cause other problems.)

This opened the file in my text editor (I use Edit Pad Pro.)

Then I added the following to the end of the wp-config.php:


Using http not https


Making sure to use the www

I clicked Save in my local file editor, then went back over to FileZilla which then showed a prompt to Upload the file back to the server.

I clicked Yes, and checked to make sure the “Owner” of the file hadn’t changed.

This worked for me.

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.

You could also add following code to wp-config.php to gain access to WordPress backend,

define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')

Thank you @vpsfix ! Your fix tidied up everything, and https is now running the show.

So now my wp-config.php additions look like this:

define('FORCE_SSL_ADMIN', true);
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')



After going through the steps above which restored access to the back end of my Wordpress site, I found the following:

I deleted the domain name entirely from my Digital Ocean account - it was causing excess redirects, and was not necessary. Only the Cloudflare DNS settings are necessary which point the domain (and the www version) to the IP address of the Wordpress droplet on Digital Ocean.

Then (again using FileZilla as above) I changed the URLs in wp-config.php to:


(removing the www from both of the URLs)

Everything now still works (including the admin login page at /wp-admin), and without the extra DNS re-directs.

Also I added the domain name in my Digital Ocean account and created an A (@) record pointing to the Wordpress droplet, as well as a www CNAME record aliasing that A (@) record.

Was that the correct thing to do?