The homepage loads fine, most posts load fine, but one category or a handful of URLs die with ERR_TOO_MANY_REDIRECTS (“redirected you too many times”). This exact case came up on the WordPress.org forums this week: only some category pages of a store were looping, the site sat behind Cloudflare, and nobody could tell at first where the redirect came from.
When the whole site loops, it is almost always an HTTPS mismatch. When only some pages loop, it is almost always a redirect rule that matches part of the URL. The trick is to stop guessing and let the HTTP headers tell you which layer sends the redirect.
Step 1. Trace the loop with curl, not the browser
Browsers cache 301 redirects, so after you fix something the browser may keep looping anyway. Use curl from your computer or the server so every test is fresh:
curl -sIL --max-redirs 10 "https://example.com/category/broken-category/" | grep -iE "^(HTTP|location|server|x-redirect-by|cf-ray)"
You get one block per hop: a status line, the Location it points to, and a few headers. If the loop is real, the list repeats the same few URLs until curl hits the limit of 10 redirects and stops.
Look at two things in that output. First, the Location values: what changes between hops? Second, the x-redirect-by header. WordPress adds it when the redirect comes from wp_redirect(), and plugins that redirect through WordPress can put their own name in it. No x-redirect-by header usually means the redirect happened before PHP ran: in .htaccess, in the nginx config, in the hosting panel or at Cloudflare.
Step 2. Read the pattern in the Location headers
The way the URL flips between hops points straight at the culprit:
https://tohttp://and back: an HTTPS mismatch between Cloudflare (or a load balancer) and the origin. Jump to Step 5.- With and without a trailing slash, or
wwwand non-www: two layers disagree about the canonical URL, for example an.htaccessrule and the WordPress permalink settings. - Between two different paths (
/category/fridges/to/shop/fridges/and back): two redirect rules that undo each other. Usually one of them is old.
Only some URLs failing tells you the rule matches a word or a path prefix, not the whole site. Note that word, because you search for it next.
Step 3. Search .htaccess and the web server config for the rule
Back up .htaccess before you touch it. Then list every redirect line in the site root and in any subfolder that has its own .htaccess:
cd /path/to/wordpress
cp .htaccess .htaccess.bak
find . -name .htaccess -not -path "./wp-content/cache/*" -exec grep -HnE "Redirect|RewriteRule|RewriteCond" {} \;
You should see the standard WordPress block (RewriteRule . /index.php [L] and friends) plus anything someone added. A RedirectMatch or RewriteRule line with your keyword in it is the prime suspect, especially if it sits above # BEGIN WordPress.
Comment the line out with a #, save, and run the curl command from Step 1 again. If the loop is gone, you found it. Rewrite the rule so it does not match its own target, or delete it.
On nginx there is no .htaccess, so search the server config instead:
sudo grep -rnE "return 30[12]|rewrite " /etc/nginx/
For more on what normally belongs in that file, see my WordPress .htaccess file examples.
Step 4. Find redirects stored in the database
If curl showed an x-redirect-by header with a plugin name, the rule lives in that plugin. Redirect plugins and SEO plugins with a redirect manager keep their rules in the database, and old ones survive migrations and slug changes.
WP-CLI can search every table for the keyword from Step 2 without you knowing the plugin’s table names. Export the database first:
wp db export before-redirect-fix.sql
wp db search "fridge" --all-tables
Each match lists the table and column with the matching text. Ignore hits in posts and postmeta, and look for redirect tables or option rows that contain both the source and the target URL. Then edit or delete that redirect from the plugin’s own screen, not with raw SQL.
To confirm a plugin is responsible, deactivate the redirect and SEO plugins one at a time and rerun curl after each. If you cannot log in, wp plugin deactivate redirection (or whatever slug wp plugin list shows) works from the shell.
💡 Purge your page cache after each change. Some cache setups store the redirect response itself, so the loop survives until the cached copy is gone.
Step 5. Rule out Cloudflare and the proxy
A cf-ray header in the curl output means the response went through Cloudflare. To see whether Cloudflare or your server sends the redirect, ask the origin directly and skip Cloudflare:
curl -sIL --max-redirs 10 --resolve example.com:443:203.0.113.10 "https://example.com/category/broken-category/" | grep -iE "^(HTTP|location)"
Replace 203.0.113.10 with your server IP. If the origin answers with a normal 200, the loop is created at Cloudflare. If the origin loops too, the problem is on your server and Steps 3 and 4 apply.
At Cloudflare, check these in order:
- Redirect Rules and old Page Rules that match the looping path. A forwarding rule that points to a URL the origin redirects back is a classic partial loop.
- The SSL/TLS encryption mode. On Flexible, Cloudflare talks to your server over plain HTTP, so an origin rule that forces HTTPS loops forever. The fix is to remove the origin redirect or switch to Full or Full (strict).
- Always Use HTTPS and HSTS on the Edge Certificates page. Both loop if anything at the origin redirects HTTPS back to HTTP.
All three causes are listed in Cloudflare’s ERR_TOO_MANY_REDIRECTS troubleshooting page. If the loop hits the login page only, my older post on the admin login page refreshing and redirecting covers that case.
Step 6. Tell WordPress the request was HTTPS
When a proxy or load balancer terminates SSL and forwards plain HTTP, WordPress thinks the request is insecure and redirects it to HTTPS, which arrives as HTTP again. The official HTTPS documentation solves this by reading the X-Forwarded-Proto header the proxy sets.
Back up wp-config.php, then add this above the line /* That's all, stop editing! */. I added an isset() check so PHP does not throw a warning on requests that arrive without the header:
define( 'FORCE_SSL_ADMIN', true );
// Behind a proxy that sets X-Forwarded-Proto (it may be a list like "http,https")
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
&& strpos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https' ) !== false ) {
$_SERVER['HTTPS'] = 'on';
}

Only use this when a proxy really sits in front of the site and sets that header. Then fix the remaining http:// links in your content, as described in the mixed content error post.
Keep redirects in one place
Partial loops happen because redirects pile up in four or five layers over the years: the hosting panel, .htaccess, an SEO plugin, a redirect plugin and Cloudflare. Pick one layer for path redirects (a plugin or .htaccess, not both) and leave HTTPS and www handling to a single other layer.
Hosting panels are the easiest layer to forget. In cPanel, the Redirects tool writes its rules into .htaccess, so Step 3 finds them. In OpenPanel, a domain redirect is set on the Domains page and, per the docs, applies before the request reaches your web server, so it never shows up in .htaccess. If curl shows a redirect with no x-redirect-by header and nothing in your files, check the panel.
TL;DR: As of 2026-11-15 this is still one of the most common “site half works” reports. Run curl -sIL on the looping URL, see what changes between hops and whether x-redirect-by is set, then search .htaccess, the database and Cloudflare Rules for the keyword in the URL. A loop on only some pages is nearly always one forgotten redirect rule, not a broken WordPress install.

