8

Stuck in an infinite loop when trying to log in to my wordpress site. I type in the URL/wp-admin and then it loops me back to the regular website, not the admin login page.

I have tried with http and https to no luck...

  • take backup & Delete .htaccess File – ravi patel Feb 27 '18 at 8:48
10

I found a solution. In wp-config.php add:

define('FORCE_SSL_ADMIN', false);

In my situation, I migrated to https from http, and use plugin Rename wp-login.php

My wp-config.php contained the lines:

define('WP_SITEURL','https://example.com');
define('WP_HOME','https://example.com');

Without the line define('FORCE_SSL_ADMIN', false);, a redirect loop occurs.

  • 2
    Thanks. This fixed the issue for me as well. I think using Cloudflare also plays a part in causing this redirect loop. – hermanschutte May 10 '18 at 4:49
  • In theory you never want admins to be logging in over an insecure connection, so turning off FORCE_SSL_ADMIN is usually a bad idea. – user45623 Aug 3 '18 at 1:01
  • This did not help. – haxpanel Mar 19 at 13:33
3

I've just solved an issue with this symptom. The 8 key and salt values must be present in the wp-config.php file or admin doesn't work.

I had these in the file, but because of how I dynamically generated wp-config.php the values were appended at the bottom of the file. Any constant definitions (define()) must be placed above the /* That's all, stop editing! Happy blogging. */ line.

Wordpress gave no error or logs to indicate it was missing config items. This also stopped 'WP_DEBUG', true working. Once I moved all of these higher in the wp-config.php file everything started working.

2

Don't worry, you'll be back in quick if you follow these steps one at a time, until one succeeds!

  1. Clear you cookies - Clear your local browser cookies (follow instructions for whatever browser you are using.
  2. Deactivate All Plugins - Rename /wp-content/plugins/ directory to plugins_OLD
  3. Revert Back to the Default Theme - Go to /wp-content/themes/ directory and rename your current theme directory to anything (like theme_OLD).
  4. "Delete" .htaccess File - Again using FTP software, rename this to .htaccess_OLD
  5. Update Site URL - In wp-config.php add these lines (using your url of course):

define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');

  • 1
    I found the same instructions elsewhere on web, but skipped #5 because it seemed too simple. Step #5 solved my problem on localhost. – MTAdmin Aug 18 '18 at 14:22
0

I spend hours trying to resolve this, did everything. Eventually notice a log about group write permissions on the wp-login.php file. Looked and the server file permissions were 664 .. changed them to 644 and problem solved.

0

I had the same issue after moving my site from a production host to localhost for dev testing. Steps that work for me in production didn't work locally. For instance, when using Chrome as my browser, entering

http://localhost/wp/wp-admin would redirect to

http://localhost/wp/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fwp%2Fwpcurrent%2Fwp-admin%2F&reauth=1.

Entering my username/password would redirect back to the second link with a new username/password prompt.

Firefox resolution: add to wp-config.php:

define('WP_HOME','http://your_url.com'); 
define('WP_SITEURL','http://your_url.com');

Chrome resolution: Remove the redirect querystring from the login page: e.g. http://localhost/wp/wp-login.php .

Yes, I'm fairly new to Wordpress and I'm not 100% certain of the internal route for logins and redirects after authentication, so much trial and error was involved to find these two solutions. Hopefully they can help someone else.

Not the answer you're looking for? Browse other questions tagged or ask your own question.