We use Wordpress extensively – we self host the wordpress files on our own servers or with a 3rd party hosting company like Godaddy or 1&1 Internet.

For the most part Wordpress works great but if you look under the hood there about a trillion files, not to mention a bunch of 3rd party plugins – the end result is that eventually something goes wrong and its hard to trouble shoot when it does. Often the end result is a complete reinstall of all files and database. Not fun. We’d rather be blogging.

The Wordpress Admin Site Login Redirect Loop Error

We recently setup a new web site with a new Wordpress Blog – lets call it example.com.

For some reason when we went to Login to the admin site (with the correct username and password) the login.php script would redirect back to wp-admin directory. Resulting in an endless loop and preventing us from logging in to the Wordpress admin site.

The Wordpress Redirect URL

Just to give you an idea, the URL after the redirect was http://www.example.com/blog/wp-login.php?redirect_to=http://www.example.com/blog/wp-admin

To cut a long story short and after trying many many different strategies to resolve this issue (and many hours) we finally came up with the solution:

The Solution

Simply paste @define(‘ADMIN_COOKIE_PATH’, ‘/’); to the very top of your Wordpress wp-config.php file. (This file is in the root of your Wordpress directory).

We finally found the answer by Googling various keywords but it took a while to come up with the right keywords that lead us to another user who had this same problem.

Cookies no doubt were the issue here but we got this error on all browsers and across multiple networks so it was in no way isolated to a single computer.
Clearing all cookies from the browsers also did not help, neither did deleting all plugins as some people suggested.

How to login to your Wordpress admin site when all else fails to solve the redirect loop

One of the frustrating things about this problem was that we could not log back in to the admin site to try to resolve this problem by tweaking settings from within Wordpress admin site.
Eventually we found a hack that got us in.

Wordpress login redirect loop error

After entering the username and password and hitting submit the Wordpress admin site loads in the following sequence if you watch the URL:

http://www.example.com/blog/wp-login.php

http://www.example.com/blog/wp-admin

http://www.example.com/blog/wp-login.php?redirect_to=http://www.example.com/blog/wp-admin

(The last url bringing you back to where you started – not what you want)

As soon as http://www.example.com/blog/wp-admin appears hit the stop button on your browser so that the page stops loading.
Then click in the URL bar of your browser (which should still contain the URL http://www.example.com/blog/wp-admin) and hit enter to reload the page.
This then took us direct to the admin site no problem

Good luck

Posted on: Saturday, June 19th, 2010 - 1 year, 7 months ago
Trackback

Leave a Reply