Home / Fix guides / Redirect loop (too many redirects) / WordPress

WordPress fix guide

How to fix ERR_TOO_MANY_REDIRECTS on WordPress

A redirect loop means your site keeps sending the browser from one address to another and never lands on a page. On WordPress it is almost always caused by a mismatch between the site address settings, an HTTPS redirect, a plugin, or a CDN.

The browser message varies ("This page isn't working", "too many redirects", ERR_TOO_MANY_REDIRECTS), but the cause is the same: two things disagree about the correct address, and each one redirects to the other. For example, WordPress thinks the site is at https://www.example.com, while a server rule sends everything to https://example.com. This guide walks you through the usual WordPress causes, from the quickest check to the more technical ones. For the general explanation, see the redirect loop guide.

Before you change anything

Two minutes of prevention save a lot of trouble:

  • Open the page in a private window. If it loads there, the problem is a stale cookie in your normal browser. Clear cookies for your domain and try again.
  • If you can still log in to the dashboard, make a backup first. If you cannot, copy wp-config.php and .htaccess to your computer before editing them.
  • Note whether the loop affects the whole site, only /wp-admin/, or a single page. A single page points to a redirect plugin or a page-level rule. The whole site points to settings, SSL or server rules.

Step by step

  1. Clear the browser cache and cookies, and purge site caches. If you use a caching plugin or your host has its own cache, purge it. Browsers also remember permanent (301) redirects, so test in a private window.
  1. Check the two address settings. Go to Settings, then General, and look at WordPress Address (URL) and Site Address (URL). They should normally be identical, use https://, and match your preferred version (with or without www). If the fields are greyed out, the values are fixed in wp-config.php (see step 3).
  1. Set the addresses in `wp-config.php` if you cannot reach the dashboard. Open the file in your hosting file manager or over SFTP. Look for lines that define WP_HOME and WP_SITEURL. Make sure they hold the exact address you want, or add them above the line that says "That's all, stop editing":
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
  1. Turn off plugins. Redirect, SEO, security, SSL and caching plugins are the usual suspects. If you cannot log in, rename the folder wp-content/plugins to plugins-off using your file manager or SFTP. WordPress then deactivates all plugins. If the loop disappears, rename the folder back and deactivate plugins one at a time from the Plugins screen to find the culprit. Also check any redirect rules saved inside a redirect plugin.
  1. Reset `.htaccess` (Apache and LiteSpeed hosts). Rename .htaccess to .htaccess-old, then load the site. If it works, go to Settings, then Permalinks, and click Save Changes to make WordPress write a fresh file. A default WordPress file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you had custom HTTPS or www rules, add them back one at a time, above the WordPress block, and test after each. Sites on Nginx do not use .htaccess; the redirects live in the server configuration, which your host or developer has to check.

  1. Check Cloudflare or another CDN. A very common cause is Cloudflare's SSL/TLS mode set to Flexible while your server also forces HTTPS. Cloudflare talks to your server over plain HTTP, the server redirects to HTTPS, and the loop begins. If your server has a valid certificate, set the mode to Full or Full (strict). Other CDNs and proxies have similar settings.
  1. Check for a proxy or load balancer. Some hosts terminate HTTPS before the request reaches WordPress. WordPress then thinks the request is plain HTTP and redirects forever. Your host's support can tell you if this applies, and they usually know the correct fix for their setup.
  1. Pick one version of the address and stick to it. Only one of http or https, and only one of www or non-www, should be the final destination. The settings in step 2, the server rules and the CDN should all agree. If you are also setting up the HTTPS redirect itself, see fixing a missing HTTP to HTTPS redirect on WordPress.

Check that it is really fixed

Load the four variants of your address in a private window: http://example.com, http://www.example.com, https://example.com and https://www.example.com. Each should end on the same final address after at most one or two redirects. If you are comfortable with a terminal, this command shows each hop:

curl -IL http://example.com

You should see one or two 301 responses and then a 200. Many repeated 301 or 302 lines mean the loop is still there.

Finding loops you did not notice

A loop can affect only a few URLs, such as an old page with a redirect rule that points back to itself, and you may never see it yourself. SiteMonday's week 6 service (broken links and 404 sweep) detects redirect problems like this and lists them in the ranked fix list. Fixing them is up to you or your developer.

When to ask for help

If you have worked through the steps and the loop remains, contact your host. They can see server logs, Nginx or Apache rules, and proxy settings that you cannot reach from the dashboard. Tell them which steps you tried and whether the loop affects the whole site or only /wp-admin/.

Not on WordPress? Read the general guide to redirect loop (too many redirects), or the guide for Cloudflare, Nginx, Apache, Next.js, WooCommerce, cPanel.

Questions

Why does the redirect loop only happen on /wp-admin/?

Usually the login or admin area is forced to HTTPS by a constant such as `FORCE_SSL_ADMIN`, a security plugin or the server, while the site address settings or a proxy say HTTP. Check the addresses in Settings, then General, and the SSL mode of your CDN.

Can I fix the loop if I cannot log in to WordPress?

Yes. Use your host's file manager or SFTP to edit `wp-config.php`, rename `.htaccess`, or rename the `wp-content/plugins` folder. These three actions cover most causes without needing the dashboard.

Will deleting .htaccess break my site?

Not permanently. Rename it instead of deleting it, so you can restore it. WordPress recreates the default rules when you save Permalinks, though custom redirects and security rules you added by hand will need to be put back.

Did an SSL plugin cause my redirect loop?

It can, especially if your server, CDN or host also forces HTTPS. Deactivate the plugin and check that only one layer handles the HTTPS redirect.

Why does Cloudflare cause too many redirects on WordPress?

If its SSL/TLS mode is Flexible but your site forces HTTPS, Cloudflare connects to your server over HTTP and the server keeps redirecting it. Switching to Full or Full (strict) with a valid certificate on your server normally fixes it.

More WordPress fixes