WordPress Infinite 302 Redirect loop on login after Reverting or Overwriting Folders
A few weeks ago, I updated a WordPress installation to 4.0, only to find out that the theme it was using, was not yet fully compatible with 4.0. So in order to revert to a prior version of WordPress, I had to download the version I wanted, and remove and re-upload only the wp-admin and wp-includes directories.
Once this was done, the site began functioning normally again, but once I logged into the site, I realized I was having a small issue. I would enter my credentials, and once WordPress would redirect me to the admin area (wp-admin), it would just perform a 302 redirect over and over, until the browser just quit. I did some googling and found that a number of other users have had this issue and fixed it with a change of permissions on those folders. (WordPress directories should be 755 by default). I made the permission tweaks, and still had the same error. Tried disabling plugins, themes, etc, same error. Finally, by a matter of chance, I noticed that I could not create any files via cPanel, in this newly created wp-admin directory. “Aha!” it has to be directory ownership!
So upon changing directory ownership to my cPanel user, and not the root user, WordPress was again able to recognize the wp-admin directories and default documents, and everything loaded correctly.
So the bottom line, if you’re having issues with infinite 302 redirects on the WordPress wp-admin area, ESPECIALLY after overwriting that folder or re-uploading it, check that folder permissions are set at 755, and more importantly folder ownership is the correct user. I wasted quite a few hours trying to figure this one out.