Skip to content

Fix WordPress Redirect Loop (Too Many Redirects)

Fix WordPress redirect loop

If your site shows ERR_TOO_MANY_REDIRECTS or keeps bouncing between URLs, you have a redirect loop.

This is almost always caused by one of these:
- HTTP vs HTTPS mismatch
- www vs non-www mismatch
- Cloudflare SSL mode set incorrectly
- Conflicting redirects from WordPress, .htaccess, and a CDN at the same time

The goal is simple: pick one canonical URL and redirect to it once.


Step 1: Do the quick browser reset

  1. Open the site in a private/incognito window.
  2. Clear cookies for the domain (cookies are often the trigger).
  3. Temporarily disable browser extensions.

If it still loops, continue.


Step 2: Decide your canonical URL

Pick one:
- https://example.com (recommended), or
- https://www.example.com

From this point, everything should redirect to your choice.


Step 3: Check WordPress Site URL settings

If you can access wp-admin:

  1. Settings → General

  2. Set both:

  • WordPress Address (URL)
  • Site Address (URL)
    to your canonical URL (HTTPS and your chosen www/non-www)

If you cannot access wp-admin, update via database.

Fix via database (phpMyAdmin)

In your WordPress database, edit these two values in the *_options table:

  • siteurl
  • home

Set them to your canonical URL, for example:
- https://example.com

Tip

If your table prefix is not wp_, your options table will be something like abc_options. Look for the table ending with _options.


Step 4: Cloudflare users: check SSL mode (critical)

If you use Cloudflare and your origin server has a valid SSL certificate, your Cloudflare SSL mode should be:

  • Full (Strict)

Avoid:
- Flexible (classic redirect-loop generator on WordPress)

After changing SSL mode:
- Purge Cloudflare cache
- Retest in incognito


Step 5: Remove conflicting redirects in .htaccess

A common loop is: WordPress forces HTTPS, .htaccess forces www, and the CDN forces non-www.

Quick test

  1. In your site root, rename .htaccess to .htaccess.bak
  2. Reload the site

If the loop stops, the redirects are inside .htaccess.

Safe redirect pattern (one redirect rule only)

Choose one of the following, not both.

Force HTTPS (no www change)

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Force HTTPS + non-www (example.com)

RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

Then keep your normal WordPress rewrite rules below.


Step 6: Clear caches

After URL changes:
- Purge your cache plugin (LiteSpeed Cache, etc)
- Purge CDN cache (Cloudflare)
- Clear browser cache and cookies again


Step 7: WordPress HTTPS detection fix behind proxy (rare)

If WordPress thinks HTTPS is off behind a proxy/CDN, it may loop.

Add to wp-config.php (only if needed):

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
  $_SERVER['HTTPS'] = 'on';
}

When to contact GOZEN HOST Support

Open a ticket if:
- You do not use Cloudflare and the loop still happens
- You updated siteurl/home but it keeps reverting
- The site loops only on specific pages (could be plugin-level redirects)

Include:
- Your canonical URL choice
- Whether you use Cloudflare (and SSL mode)
- Any .htaccess redirect rules you added
- A screenshot of the error


Summary

Redirect loops are fixed by consistency: canonical URL → WordPress siteurl/home → one redirect rule → CDN SSL mode → purge cache.