Wordpress

How to Fix ERR_TOO_MANY_REDIRECTS (Step-by-Step Guide)

How to Fix the "ERR_TOO_MANY_REDIRECTS" Error (A Step-by-Step Guide) If you open your website a...

Author admin
Published: November 2, 2025
How to Fix ERR_TOO_MANY_REDIRECTS (Step-by-Step Guide)
Share this article:

How to Fix the "ERR_TOO_MANY_REDIRECTS" Error (A Step-by-Step Guide)

 

If you open your website and see a message like “This page isn’t working – redirected you too many times” or the ERR_TOO_MANY_REDIRECTS error, don't worry. This is a common redirect loop problem that can happen on any website, but it's completely fixable.

 

Whether you're on WordPress, Nginx, Apache, Laravel, or even a static site, this guide will show you how to find the cause and fix the "too many redirects" error step-by-step.

 

What is an "ERR_TOO_MANY_REDIRECTS" Error?

 

When you visit a website, your browser asks the server for the page. Sometimes, the server tells the browser to go somewhere else—this is called a redirect. A redirect is normal and helpful when you move a page, switch from http to https:, or add www to your domain.

 

The ERR_TOO_MANY_REDIRECTS error happens when a redirect points to another URL, which points back to the first URL (or goes through a long chain that eventually points back). This creates an infinite loop.

 

Your browser will follow the redirects a few times, but after a limit (usually 10-20), it gives up and shows the "Too Many Redirects" error to prevent it from crashing.

Example of a Redirect Loop:

 

1.http://example.com → redirects to → https://example.com

2.https://example.com → redirects back to → http://example.com ...and the loop repeats forever.

 

What Causes the "Too Many Redirects" Error?

 

A redirect loop is always caused by a misconfiguration. Here are the most common reasons:

  • Conflicting HTTPS Settings: Forcing HTTPS in multiple places (e.g., on your server and in your WordPress settings).
  • Cloudflare Flexible SSL: Using Cloudflare's "Flexible" SSL mode while also forcing HTTPS on your server.
  • Misconfigured Server Redirects: Incorrect or duplicate redirect rules in your .htaccess (Apache) or .conf (Nginx) files.
  • Incorrect CMS URLs: Your WordPress or Laravel Site URL settings don't match the actual domain (e.g., http vs https or www vs non-www).
  • Caching Problems: Your browser or a CDN (like Cloudflare) has "remembered" an old, broken redirect.
  • Proxy/CDN Issues: Your server isn't correctly detecting HTTPS when behind a reverse proxy or CDN, causing it to redirect an already-secure connection.
  •  

How to Fix the "Too Many Redirects" Error (10 Steps)

 

Let's go through the fixes, starting with the most common and easiest.

 

Step 1: Test Your Redirect Chain

 

Before you change anything, you need to see what is redirecting. Use a free online tool like redirect-checker.org or httpstatus.io.

 

Enter your domain (e.g., http://example.com) and see the "path" it takes. If you see it bouncing back and forth between the same two URLs, you've confirmed the loop. This test can also give you clues about where the redirect is coming from (e.g., Cloudflare, Nginx, Apache).

 

Step 2: Clear All Caches (Browser, CDN, and Site)

 

This is the quickest and easiest fix to try first. Caching layers can store old, broken redirect rules.

 

1.Browser Cache: Clear your browser's cache and cookies.

2.CDN Cache (Cloudflare): If you use Cloudflare, log in, go to Caching → Configuration, and click Purge Everything.

3.Site Cache (WordPress/Laravel): If you can access your site's admin, clear your caching plugin (e.g., WP Rocket, LiteSpeed) or run php artisan cache:clear (Laravel).

 

Now, re-test your site in an incognito window. If it still fails, move to the next step.

 

Step 3: Check Cloudflare SSL/TLS Mode (The Most Common Culprit)

 

If your site uses Cloudflare, this is the #1 cause of redirect loops.

 

  1. Log in to your Cloudflare dashboard.
  2. Go to SSL/TLS → Overview.
  3. Look for the SSL/TLS encryption mode.
  4. If it is set to Flexible, change it to Full or Full (Strict).

Why this happens: "Flexible" mode means Cloudflare connects to your server over http. If your server is also set up to redirect all http traffic to https, it creates a loop: User (https) → Cloudflare (http) → Your Server (redirects to https) → Cloudflare (http) ...and so on.

 

Setting it to Full or Full (Strict) tells Cloudflare to connect to your server over https:, which breaks the loop.

 

Step 4: Fix "Too Many Redirects" in WordPress

 

If you're on WordPress, the error is almost always a mismatch in your URL settings or an HTTPS-forcing plugin.

 

Check URLs in WordPress Admin

 

If you can log in:

  1. Go to Settings → General.
  2. Make sure both fields match exactly:

If one uses http and the other https, or one has www and the other doesn't, fix them to be identical and click Save Changes.

 

Fix Redirects via wp-config.php

 

If you can't log in due to the redirect loop:

 

  1. Connect to your site via FTP or your host's File Manager.
  2. Open the wp-config.php file in your website's root folder.
  3. Add these two lines just above the /* That's all, stop editing! */ line:

define('WP_HOME', '[https://www.example.com](https://www.example.com)'); define('WP_SITEURL', '[https://www.example.com](https://www.example.com)');

(Remember to replace example.com with your actual domain)

 

Add HTTPS Detection for Proxies (Cloudflare)

 

Sometimes WordPress doesn't detect HTTPS correctly when behind a proxy. Add this code to your wp-config.php file (above the "stop editing" line) to fix it:

```

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

```

 

Step 5: Fix Redirect Loops in Apache (.htaccess)

 

If your server uses Apache, the loop is likely in your .htaccess file. This file is in the root folder of your website (you may need to "show hidden files").

 

A common mistake is having two different redirect blocks, or a rule that redirects incorrectly.

 

Here is a correct and safe example that forces HTTPS and www in one rule:

```

RewriteEngine On # Force HTTPS and www RewriteCond %{HTTPS} !=on [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(.*)$ [NC] RewriteRule ^(.*)$ [https://www.example.com](https://www.example.com)%{REQUEST_URI} [L,R=301]

```

 

(Replace example.com with your domain)

 

Delete any other RewriteRule lines that also handle HTTPS or www redirects to prevent conflicts.

 

Step 6: Fix Nginx Redirect Loops

 

If you're using Nginx, your redirect rules are in a .conf file, usually in /etc/nginx/sites-available/ or /etc/nginx/conf.d/.

 

A common mistake is having an http server block that redirects to https, and an https block that also redirects.

 

Here is a clean setup that correctly redirects all traffic to https://www.example.com:

 

```

# This block handles non-secure traffic
server {
   listen 80;
   server_name example.com [www.example.com](https://www.example.com);
   # Redirects all http traffic to https with www
   return 301 [https://www.example.com](https://www.example.com)$request_uri;
}

# This block handles all secure traffic
server {
   listen 443 ssl;
   server_name [www.example.com](https://www.example.com);

   # SSL Certs
   ssl_certificate /etc/ssl/certs/example.crt;
   ssl_certificate_key /etc/ssl/private/example.key;

   # Other settings
   root /var/www/html;
   index index.php index.html;

   # ... other location blocks etc.
}

# This block is optional - redirects non-www https to www https
server {
   listen 443 ssl;
   server_name example.com;

   # SSL Certs
   ssl_certificate /etc/ssl/certs/example.crt;
   ssl_certificate_key /etc/ssl/private/example.key;

   return 301 [https://www.example.com](https://www.example.com)$request_uri;
}

```

 

After saving your changes, check the config and reload Nginx:

 

#sudo nginx -t sudo systemctl reload nginx

 

 

Step 7: Fix Laravel Redirect Issues

 

In Laravel, redirect loops usually come from two places:

 

  1. Incorrect .env file: Open your .env file and make sure your APP_URL is set to the correct HTTPS version: APP_URL=https://www.example.com

     

    Then, clear your configuration cache:

     

    php artisan config:clear

    php artisan cache:clear

    php artisan route:clear

     

     

  2. Middleware Redirects: If you are using middleware (like App\Http\Middleware\TrustProxies.php or a custom one) to force HTTPS, make sure it's not conflicting with a server or Cloudflare redirect. If you're using Cloudflare, make sure your TrustProxies middleware is set up to trust Cloudflare's IPs.
  3.  

Step 8: Fix Node.js (Express) Redirect Loops

 

If you use a Node.js/Express server behind a proxy (like Nginx or Cloudflare), you must tell Express to trust the proxy's X-Forwarded-Proto header.

Add this before your redirect middleware:

```

// Trust the proxy (e.g., Nginx, Cloudflare)
app.enable('trust proxy');

// Redirect non-https traffic
app.use((req, res, next) => {
 if (req.protocol !== 'https;
   // Use 301 for permanent redirect
   return res.redirect(301, 'https://' + req.headers.host + req.url);
 }
 next();
});

```

 

Without app.enable('trust proxy'), req.protocol will always be http (the protocol between the proxy and Node), and it will loop forever.

 

Step 9: Check Your Server Configuration Files

 

If you've checked everything else, it's possible a conflicting redirect rule exists elsewhere on your server.

 

For Apache: Run this command to find all redirect rules in your enabled sites:


 #sudo grep -R "Redirect" /etc/apache2/sites-enabled/ 

Look for any rules that conflict with your .htaccess file.

 

For Nginx: Run this command to find all return 301 rules: 

#sudo grep -R "return 301" /etc/nginx/sites-enabled/ 

 

Make sure you don't have conflicting redirects in different config files.

 

Step 10: Test Your Redirects Again

 

After making your changes and clearing all caches, use redirect-checker.org again.

 

You should see a clean, single redirect path.

 

Example of a Healthy Redirect Setup: If your main site is https://www.example.com, all variations should redirect there in one step:

 

  • http://example.com → 301 → https://www.example.com (200 OK)
  • http://www.example.com → 301 → https://www.example.com (200 OK)
  • https://example.com → 301 → https://www.example.com (200 OK)
  •  

If you see this, your site is fixed!

 

How to Prevent Redirect Loops in the Future

 

  • Use Only One Redirect Method: Don't force HTTPS in your .htaccess and in a WordPress plugin. Pick one and stick to it. (Server-level is usually fastest).
  • Use "Full (Strict)" SSL: If you use Cloudflare, always use "Full (Strict)" mode.
  • Keep URLs Consistent: Always use the same URL (e.g., https://www.example.com) in all your application settings.
  • Test After Changes: Any time you install an SSL certificate or change domains, test your redirects immediately.

 

 

FAQ

 

Q: Can a WordPress plugin cause an ERR_TOO_MANY_REDIRECTS error? 

 

A: Yes, absolutely. Plugins that force HTTPS (like "Really Simple SSL") or manage redirects (like "Redirection") can conflict with your server's rules or WordPress's own settings, leading to a redirect loop. If the error started after you installed or updated a plugin, try deactivating it.

 

Q: Is ERR_TOO_MANY_REDIRECTS bad for my website's SEO?

 

A: Yes, it's very bad for SEO if not fixed quickly. When the error is active, search engines like Google cannot crawl your page. This means they can't index your content, and if the problem persists, your page will be dropped from search results. Visitors also can't access your site, which signals a poor user experience.

 

Q: Why do I need to clear my cache after fixing the problem? 

 

A: Your browser, as well as CDN services like Cloudflare, store (or "cache") redirects to load your site faster. Even after you've fixed the redirect loop on your server, these caches might still "remember" the old, broken redirect and send you into the loop again. Clearing all caches ensures that they fetch the new, correct rules.

 

Q: What's the difference between Cloudflare's "Flexible" and "Full (Strict)" SSL modes? 

A:

  • Flexible: Your visitors connect to Cloudflare securely (HTTPS), but Cloudflare connects to your server insecurely (HTTP). This is the most common cause of redirect loops if your server also tries to redirect to HTTPS.
  • Full (Strict): Your visitors connect to Cloudflare securely (HTTPS), and Cloudflare also connects to your server securely (HTTPS). This is the most secure and recommended setting, as it breaks the potential redirect loop and encrypts all traffic.
  •  

Q: How do I fix the "too many redirects" error in Laravel? 

 

A: The two most common fixes for Laravel are:

  1. Check your .env file and make sure the APP_URL is set to the correct https version (e.g., APP_URL=https://www.example.com).
  2. After saving, clear your config cache by running php artisan config:clear and php artisan cache:clear from your terminal.

     

Categories: Wordpress
11 min read
Was this article helpful?

Related Articles

Need More Help?

Our support team is available 24/7 to assist you with any questions

Contact Support