user16520439
user16520439

Reputation: 21

Strange wp-admin login issue with redirect and reauth=1

I cannot login to the admin account on my wordpress site from the normal link: https://www.my_site.com/wp-admin. Every time I load https://www.my_site.com/wp-admin in the browser, the URL is rewritten to this URL:

https://www.my_site.com/wp-login.php?redirect_to=https%3A%2F%2Fwww.my_site.com%2Fmy_subdirectory%2Fwp-admin%2F&reauth=1

(NOTE, in the re-written URL above, "my_subdirectory" is the subdirectory under root where my wordpress site exists). When I enter the admin login credentials, the login page reloads and the URL stays the same in the browser. I'm stuck in this loop.

Here are the strange things:

  1. If I remove the "www." from the redirect parameter in the URL, I can login. So, this URL works correctly:
https://www.my_site.com/wp-login.php?redirect_to=https%3A%2F%2Fmy_site.com%2Fmy_subdirectory%2Fwp-admin%2F&reauth=1
  1. Or, if I remove "my_subdirectory%2F" from the redirect parameter in the URL, I can login. So, this URL also works correctly:
https://www.my_site.com/wp-login.php?redirect_to=https%3A%2F%2Fwww.my_site.com%2Fwp-admin%2F&reauth=1
  1. This URL also works fine:
https://www.my_site.com/wp-login.php
  1. And, if I change the Wordpress site settings for "WordPress Address (URL)" and "Site Address (URL)" from "https://www.my_site.com" to "https://my_site.com" (note, I removed the "www"), I can also login without a problem.

I have also followed the wordpress conventions for having the wordpress set in its own directory here: https://wordpress.org/support/article/giving-wordpress-its-own-directory/ And, my .htaccess file mimics the one shown on that page:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>

I would really like to have the Wordpress site settings include the "www." part of the site URL and I would like to login to my admin account from "www.my_site.com/wp-admin".

Can someone please help?

Cheers!!

Upvotes: 1

Views: 7572

Answers (2)

Luis Lima
Luis Lima

Reputation: 1

It also worked for me removing wp-cerber, in this case I just renamed the folder and it worked!

Upvotes: -1

Paul Nobel
Paul Nobel

Reputation: 3

For me it worked by deleting the Wp Cerber Plugin.

Upvotes: 0

Related Questions