Fixed: 301 redirect loop on newly restored/cloned site

If, like me, you get an endless 301 redirect loop and your browser tells you

Error 310 (net::ERR_TOO_MANY_REDIRECTS): there were too many redirects
you might solve it like this

Background: I imported a live site from a backupbuddy zip file backup. The live site is HTTPS (SSL Let’s Encrypt certificate) enabled

But in order for Local to work, you need to set siteurl and home to http:// (no https !!)

In order to find the options in the database:

  1. Open Local - Database - Adminer
  2. Select wp_option table (or replace wp_ with the prefix you have choosen)
  3. Select Search and enter
  4. option_name = home
  5. if option_value starts with https:// clicke edit and replace with http://
  6. repeat with option_name = siteurl

Now the site should work. If you still have problems may I also suggest checking or removing any .htaccess files you might have (when using nginx as the local http server)

This helped prevent the “Too Many Redirects” for my main site, but I found that as soon as I tried to visit the WordPress admin ( /wpadmin ) the problem came back.

After digging around, I finally located this declaration in my wp-config.php file:

define('FORCE_SSL_ADMIN', TRUE);

by changing it to false:

define('FORCE_SSL_ADMIN', FALSE);

the redirect loop was resolved and I was able to log in.

Just wanted to add this for anyone else who might be having a similar issue.