Redirect loop in wp-admin

admin2025-06-06  2

A site I manage has just become inaccessible to the admin today. I just updated apache on the server to enable mod_deflate and also to upgrade PHP from 5.3 to 5.4.

Since doing that every time I attempt to access /wp-admin/ I receive the redirect loop error. I tried all the usual suspects, i.e:

  • cleared cookies and cache
  • tried different browsers
  • disabled theme
  • disabled cookies
  • deleted .htaccess
  • checked site_url etc in wp_options

But no luck. I can access wp-login.php fine but not /wp-admin/

Any help would be greatly appreciated as I am totally stumped.

A site I manage has just become inaccessible to the admin today. I just updated apache on the server to enable mod_deflate and also to upgrade PHP from 5.3 to 5.4.

Since doing that every time I attempt to access /wp-admin/ I receive the redirect loop error. I tried all the usual suspects, i.e:

  • cleared cookies and cache
  • tried different browsers
  • disabled theme
  • disabled cookies
  • deleted .htaccess
  • checked site_url etc in wp_options

But no luck. I can access wp-login.php fine but not /wp-admin/

Any help would be greatly appreciated as I am totally stumped.

Share Improve this question asked Nov 12, 2013 at 15:04 Joe SpurlingJoe Spurling 1091 silver badge5 bronze badges 13
  • Have you recently moved wordpress? – Howdy_McGee Commented Nov 12, 2013 at 15:10
  • where are you redirected to? do you have errors in the php log? what happens if you disable mod_deflate?. frankly I find it unlikely that any of those changes will cause that, are you sure you haven't done anything else? – Mark Kaplun Commented Nov 12, 2013 at 15:25
  • @Howdy_McGee - no, the site has been in the same location for the last few years. The only real change has been the PHP version today which seemed to trigger the issue. I'm not receiving any errors though. – Joe Spurling Commented Nov 12, 2013 at 15:25
  • @MarkKaplun - I know it seems extremely unlikely but apart from updating Apache (and the only change there was the addition of mod_deflate) and the PHP version update I'm not aware of making any other changes. – Joe Spurling Commented Nov 12, 2013 at 15:26
  • 1 then it is your php upgrade, not sure how but that is probably a new library being used in PHP 5.4. maybe this is not the best place to get help any longer and the regular stackexchange will be better – Mark Kaplun Commented Nov 12, 2013 at 15:57
 |  Show 8 more comments

3 Answers 3

Reset to default 3

Try renaming the plugins folder to e.g. plugins-, so as to make sure it has nothing to do with them. Switch it back if it's not the case. If it was, proceed to do similar steps with each individual plugin folder until you locate the culprit.

The same for themes if you're still out of luck.

Another thing, per the comment, would be if the URLs are wrong. Say, the server wants www. and WP doesn't. Or the server wants SSL admin and WP doesn't. Or vice versa in each case. Those can very much break a site and trigger infinite redirects all over the place, so be sure to check those too. Adjust the WP config as appropriate using the relevant defines if needed: WP_HOME, WP_SITEURL, FORCE_SSL_ADMIN, FORCE_SSL_LOGIN.

If all else fails, the usual approach to debug this kind of stuff to die(__FILE__.':'.__LINE__); your way throughout WP until you nail down what is causing the infinite loop. (It could be a cron job or some odd thing like that.)

By following the script, I mean opening up the wp-admin/index.php file (which in this case is the one getting hit), and inserting die(__FILE__.':'.__LINE__); towards the top — before WP actually does anything. If it's already redirecting there, it means there's a problem with the server configuration.

If not, proceed to move the statement down step by step until the redirect occurs. Move further up, entering the included files and the relevant wp functions as needed, and continue doing the same. At one point, you'll find the exact statement that is causing the issue.

I had the permissions wrong. 775 instead of 755. Once changed, everything worked.

Check your folder permissions!

Temporary solution in the end was to downgrade PHP version back to 5.3.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749152030a316808.html

最新回复(0)