WordPress Login Redirect Loop: Fixed
WordPress keeps kicking you back to login? It's usually a site URL mismatch or a plugin conflict. Here's the quick fix and why it happens.
This Error Pisses Everyone Off
You type your credentials, hit Enter, and boom — back to the login page. No error, just spinning wheels. I've seen this a hundred times. The fix is usually dead simple.
The Most Common Cause: Site URL Mismatch
Nine times out of ten, the culprit is a mismatch between what WordPress thinks your site URL is and the actual URL you're using. This happens after moving a site, changing domains, or switching from HTTP to HTTPS.
Here's the fastest fix:
- Access your site's database via phpMyAdmin or command line.
- Run this SQL query:
UPDATE wp_options SET option_value = 'https://yourdomain.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://yourdomain.com' WHERE option_name = 'home'; - Replace
yourdomain.comwith your actual domain, including the protocol (HTTP or HTTPS). - Clear all caches — browser, server, and any plugin cache (like W3 Total Cache or WP Super Cache).
That's it. Try logging in again. If it works, you're done. If not, move to the next section.
Why This Fix Works
WordPress stores your site URL in two places: siteurl and home. When you log in, WordPress checks the URL in the database against the URL you're currently on. If they don't match, the login redirects back to the stored URL — which is the login page again. It's a circular logic fail. Updating the database breaks the loop.
Less Common Variations of This Issue
Plugins Gone Rogue
A bad plugin can intercept the login redirect. Disable all plugins temporarily:
- Rename the
wp-content/pluginsfolder towp-content/plugins-oldvia FTP or cPanel File Manager. - Try logging in. If it works, rename the folder back, then reactivate plugins one by one to find the troublemaker.
- Common offenders: security plugins, caching plugins, and membership plugins that force login.
Theme Conflict
Some themes mess with login redirects. Switch to a default theme like Twenty Twenty-Four:
- Rename
wp-content/themes/your-themetowp-content/themes/your-theme-old. - WordPress will fall back to a default theme automatically.
HTTPS Forcing Gone Wrong
If you're behind a reverse proxy (like Cloudflare or Nginx), WordPress might not detect HTTPS correctly. Add this to wp-config.php right before the /* That's all, stop editing! */ line:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$_SERVER['HTTPS'] = 'on';
}This tells WordPress to trust the forwarded protocol. Without it, the login loop happens on HTTPS-only sites.
Corrupted .htaccess
A stray rewrite rule can break login. Reset your .htaccess file:
- Rename
.htaccessto.htaccess-old. - Go to Settings > Permalinks in your WordPress admin (if you can get in) and click Save Changes. If you can't, just leave the file deleted — WordPress will create a fresh one when you next update permalinks.
Prevention Tips
Stop this from happening again:
- Always keep a backup of your
wp-config.phpand database before moving a site. - Use a staging environment for domain changes — never do it live first.
- Test your login after any plugin or theme update. Do it on a staging site, not production.
- Enable WordPress debugging temporarily after updates by adding this to
wp-config.php:
Checkdefine('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);wp-content/debug.logfor errors after a failed login attempt.
That's it. Most of the time you fix it in under two minutes with that SQL query. If you're stuck, double-check your URL — HTTP vs HTTPS is the most common trap. You'll be fine.
Was this solution helpful?