Too Many Redirects on Logout and Login Cache Problem

I am running a WP membership site with around 150 members, so not huge numbers. I have got a couple of problems on it that I think may be related.
Firstly, occasionally when a user logs in Wordpress is convinced they are already logged in, and takes them to a page asking them if they need to log out. They log out, only to be presented with the same question on the next login. If they clear their Cache the problem is solved and they can log in without a problem.
Secondly, on logout I am getting a 'Too Many Redirects' error briefly displayed prior to my 'goodbye' page. My site address is set up correctly etc.. and this is the only thing I can find that could potentially be causing that problem.
I'm not sure if these problems are related, but I have a sneaky suspicion that they are, any help would be appreciated.

  • Milan

    Hello Paul,

    Hope you are well today and won't mind me chiming here. :slight_smile:

    Could you please enble debug log to your site and see if it says something. To do that, please,

    #1) Open your site's wp-config.php file
    #2) Find line saying,

    define ( "WP_DEBUG", false );

    and replace it with

    define ( "WP_DEBUG", true );
    define ( "WP_DEBUG_LOG", true );
    define ( "WP_DEBUG_DISPLAY", false );

    Save the file and then try to replicate issue. After replicating issue, go to /wp-content/ folder and find file named debug.log there and download it to your local pc. Change its extension from .log to .txt and send it in your next post here.

    Look forward to hearing back from you. :slight_smile:
    Best Regards,

  • Paul

    Hi There,

    I have a few entries now in my debug.log some of which I have already rectified but some that you may be able to help with and some that may be related to my problem.

    The log is attached both as a log file and as a txt file.

    The lines that stood out in possible relation to the redirect problem are lines 272-276 in the debug log. They refer to a section of canonical.php that is a reference to capitalisation of WWW. I do not fully understand this though.

    The other part of this log that stood out to me we lines 277-279 which are references to WP-Defender. I wonder if anyone may shed any light on that.

    Thanks for any assistance.

  • Adam Czajczyk

    Hello Paul,

    Thank you for sharing the debug.log file.

    I reviewed the file. There's a couple of lines (repeated) related to Defender plugin but these shouldn't be an issue here and are not related to the core of the problem.

    One that bothers me though (and it also is repeated) is this part:

    [07-Oct-2016 18:22:54 UTC] PHP Notice:  Undefined index: HTTP_HOST in /home/domain/public_html/wp-content/plugins/ts-visual-composer-extend/ts-visual-composer-extend.php on line 2057
    [07-Oct-2016 18:22:56 UTC] PHP Notice:  Undefined index: host in /home/domain/public_html/wp-includes/canonical.php on line 444

    You already mentioned it. However, it's worth noting that the line related to "canonical.php" is a result of an error above which in turn is related directly to the "ts-visual-composer-extend.php" file.

    I think it's a an extension plugin for Visual Composer so if it's possible I'd suggest turning it off to see if that changes anything.

    Having that said, I'm not saying that this plugin is the source of an issue but rather a part of it and we need to find out whether it's "breaking" or if it's, let's say, "transparent" and is just a "reflection" of some underlying cause.

    Could you try disabling that plugin?

    Best regards,

  • Paul

    Hi Adam,

    Thanks for this insight. I can try turning off the VC extension plugin. It will of course have some effect on the layout of my site, however I can have a play with it over the weekend and see what effect it has. The trouble is that these issues are not easy to replicate and I have not had any reports of people being stuck in the login loop recently and I have not noticed the redirect problem myself on logout. I'm sure this is just here to drive me nuts.
    Anyway, it's these type of problems that you learn the most from, that's the positive.

    I will look at this plugin and update with anything new I learn.


  • Milan

    Hello Paul,

    Hope you are well today and won't mind me chiming here. :slight_smile:

    That would be great. But if you want, you can always create staging site of your live site and then test it the way you want it to test, this way your live site would be unaffected by plugin deactivation and you would be able to conduct any number of tests on your staging site you want to conduct.

    Hope this helps you. :slight_smile:
    Best Regards,

  • Paul

    Thanks Milan. I do have a staging site that I use for testing. The problem is that because the issue is intermittent I kind of need to volume of logins that I have through my live site to be able to recreate the problem and know if it is still occurring. This may not be the right approach I know, but I just don't know how else to go about it. I may get stuck in the login loop once every 4-6 weeks. But I get a user report it every 2-3 days. This is why I am having such a tough time properly diagnosing the problem on the site.
    Since I have had debugging enabled I am yet to have anyone contact me to report that particular problem and I've not seen it myself either. It has been going on for some time now, and while it's not a show stopper it is very frustrating, both for me and my users.

    Thanks for the input though, it is all very helpful for me.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.