• Resolved mengsel

    (@mengsel)


    Hi there, just wanted to share the solution to my grand frustration of the night. I had two websites running perfectly fine until one day I had to log in and take a peek at them again and update WP, when I encountered an obscure error…

    Upon logging in with correct credentials (I double checked first by resetting it, then manually changing it in PhpMyAdmin) I kept getting bounced back to the wp-login screen. The URL was each time appended as https://mysite/wp-login.php?redirect_to=http%3A%2F%2Fmysite%2Fwp-admin%2F&reauth=1. So I started mucking about the forums and googling fixes.

    Here are all the things that I tried, but in my case, did not work:

    • Clearing my cache, logging in in Incognito-mode, user other browsers, etc.
    • Disabling all plugins by renaming the wp-content/plugins folder
    • Disabling all themes except twentysomething
    • Doing a complete re-upload of everything WP except wp-config.php and especially re-uploading wp-login.php
    • Wiping the .htaccess file (Thank god I made a backup)
    • Checking my database if it exceeded the allowed size (Mind you this has been a fix for several cases I encountered so make sure to check that!)
    • Adding code to wp-login.php to re-specify my site URL, or, doing the same manually in PhpMyAdmin to wp_options under ‘home’ and ‘siteurl’ (Mind you this can be a fix if you’re using a different URL for your WP install than your server configuration, so that it bounces between https://www.yoursite and https://yoursite)

    So then, like the hilarious amateur I am, I came to the enlightened idea of perhaps checking the debugger out!

    TIP: when things hit the fan, churn on that debugger and amaze at the amount of useful information it provides you!

    Now the debugger gave me two pieces of info I could use:

    1. An error stating MySQL server has gone away followed by something about usermeta, meta_value and a gigantic string of information it apparently tried and failed to write into the database
    2. Several errors regarding Cannot modify header information – headers already sent

    Because I suspected the errors came in in the right order, just like that, I finally discovered the problem: the database. It looked like a session token was being written into the database, but because it was gigantic, the database timed out, making WordPress fling me back to the login page again.

    My Fix

    1. Go into PhpMyAdmin to your WordPress database
    2. Find the table named wp_usermeta
    3. Find the rows titled session_token
    4. Delete the value associated with it
    5. (Mind you the value is huge and your browser might freak out. I did it by clicking ‘edit’ for that record first, then toggling the null value for the field on and off, selecting the empty field and pressing delete a couple of times to make sure, and then hit save)

    And there you have it. A possible solution to that incessant and infuriating redirect loop problem that occurs when your database and WordPress stop playing together correctly. I’ve seen a lot of frustrated users in the forums with similar issues, so I hope this post will be of use to you. Good luck.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Hi
    I am facing the same issue but not able to figure out the exact reason.
    In my case there is no session_token & site url is all ok.

    How to solve it.

    Thread Starter mengsel

    (@mengsel)

    @avtar876 You’ll have to be a bit more specific than that. Did you follow my suggestion to enable the debugger and check out what pops up? Also, keep your eye on the errors that might pop up in your browser’s Javascript console. Those results should point you in the right direction of what exactly is breaking in your database (if it is the DB at all, which is, in this stadium, for me, a question).

    Debugger log:
    [13-Feb-2016 22:45:14 UTC] PHP Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/xxx/public_html/wp-includes/functions.php on line 3792

    [13-Feb-2016 22:46:18 UTC] PHP Notice: A feed could not be found at https://webgilde.com/en/ad-optimization/feed/. A feed with an invalid mime type may fall victim to this error, or SimplePie was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed. in /home/xxxx/public_html/wp-includes/class-simplepie.php on line 1580

    3-Feb-2016 22:46:18 UTC] PHP Notice: wpseo_pre_analysis_post_content filter/action is deprecated since version WPSEO 3.0! Use javascript instead. in /home/xxxx/public_html/wp-includes/functions.php on line 3573

    Above three error is being shown in debugger.

    I think some redirect code is inserted which i am unable to find.
    Can you suggest some other way.

    Thread Starter mengsel

    (@mengsel)

    @avtar876 seems like your problem has nothing to do with the issue I posted about – rather it might be a congruence of different errors. I’m afraid I can’t help you further apart from the basics: disable all plugins and themes, except the default WP theme, and see if that helps. If it does, try reactivating them step-by-step to isolate the issue.

    Thanx will try later.

    I had the exact problem described in mengsel’s opening post tonight, except it was plaguing my Nexus 7 tablet with me trying to login to my website using Chrome. On my Windows 10 desktop I didn’t have any problem logging in. Of course, I’d been breaking things all evening installing/configuring WP Super Cache, Theme My Login, and a half dozen other plugins.

    So who knows what caused the redirect problem, but it turns out a thorough cleaning of history/cache on my tablet browser did the trick.

    G-

    • This reply was modified 8 years, 1 month ago by gsfergusson.

    I had the same problem on a few of my websites and I simply deleted all the garbage after login.php and they all worked just fine.

    DS

    (@da-mind)

    Hello guys!
    I got same problem reauth=1 and trying to fix it from a month now even i did the same as you but my problem is always there, i’ve changed my website to https:// . when I login from frontend than click on dashboard it redirect me to
    https://myweb.com/wp-login.php?redirect_to=https%3A%2F%2Fmyweb.com%2Fwp-admin%2F&reauth=1
    and when other user log in than try to upload image for new post he got disconnected and somehow he can publish post if he didn’t try to upload anything and the post got saved..
    when i guess only admin can upload without getting disconnected i tried to fix the cookies this way:
    define( ‘COOKIE_DOMAIN’, ‘myweb.com’ );
    define( ‘SITECOOKIEPATH’, ‘/’ );
    define( ‘COOKIEPATH’, ‘/’ );
    but the problem still .. i even tried other themes, disablinf all plugins, deleting everything on .htaccess and the same thing.. hope someone can help! and thanks!

    Thread Starter mengsel

    (@mengsel)

    @da-mind

    The problem might lie in some kind of cookie being stored incorrectly, as was with my experience. Have you tried completely wiping all traces of the website in your browser history, cache and cookie storage?

    You can also find more information by turning on the debugger through wp-config.php

    • This reply was modified 8 years ago by mengsel.
    Ali Borsan

    (@aliborsan)

    in the multi site latest version, if you change the site url, you must change it also in wp_sitemeta
    it happened with me and i solved it with this method.

    PowerPhil

    (@powerphil)

    I had a similar problem until now and my solution was too simple. Maybe it can be of use.

    Use https://redbot.org/ to check the domain. It showed me that cloudflare redirected back which caused the infinite loop. Deleting the cloudflare plugin is not enough to cap the connection. Instead, change the cryptography settings in the cloudflare menu.

    luisomontano

    (@luisomontano)

    Hi I haved the same problem and I solved it changing some values in my DB…

    INSERT INTO wp_options (option_id, option_name, option_value, autoload) VALUES
    (1, ‘siteurl’, ‘https://mywebsite.mx’, ‘yes’),
    (2, ‘home’, ‘https://mywebsite.mx’, ‘yes’),
    (3, ‘blogname’, ‘mywebsite Power’, ‘yes’),

    Thread Starter mengsel

    (@mengsel)

    @luisomontano Changing your website siteurl and home address to the same might help if you’re in a redirect loop because of a discrepancy there. However, I would suggest editing them directly in the database rather than using INSERT, to avoid double entries. Just browse to the corresponding row and edit its values directly. Better safe than sorry ??

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Possible fix for sudden redirect loop at wp-login with reauth=1’ is closed to new replies.