WordPress https ‘redirected you too many times.’ error

I am hosting a wordpress site on AWS and am transitioning from http to https. After reading some resources from online I added this line to the wp-config.php file:

define('FORCE_SSL_ADMIN', true);

Now when i try to access the /wp-admin/ page I get the xx.xx.com redirected you too many times. The all of the other pages work, it is only the admin panel that is not working.

Related posts

Leave a Reply

2 comments

  1. For anyone coming here like me being behind a reverse proxy that handle the SSL stuff, it took me a while but I could find the documentation where it states what has to be done:

    https://codex.wordpress.org/Administration_Over_SSL

    It states to add an if in the wp-config:

    // in some setups HTTP_X_FORWARDED_PROTO might contain 
    // a comma-separated list e.g. http,https
    // so check for https existence
    if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
       $_SERVER['HTTPS']='on';
    

    As I don’t like to touch the config (mostly because I forget I touched it) I tried to find a more elegant way of doing it:

    https://wordpress.org/plugins/ssl-insecure-content-fixer/

    I have tried with this plugin and it works.

  2. It happened to me sometimes. Try checking between which pages the redirect occurs here:
    redirect-checker.org
    It will help you understand why it happens

    If the problem is about a loop between http://example.com and https://example.com you can try changing homeurl and siteurl to avoid this redirect. You can do this:

    • In you SQL in the wp_options table
    • Putting define('WP_HOME','http://example.com');
      define('WP_SITEURL','http://example.com');
      in wp-config.php (check here)

    Hope it helps