Website errors

How to fix "too many redirects" on your own website

A redirect loop happens when two settings keep sending the browser back and forth, most often between HTTP and HTTPS or between www and non www. Find the two rules that disagree and remove one of them.

Updated 3 min readApplies to: cPanelApplies to: Plesk

What is happening

Your browser shows "This page isn't working. yourbusiness.in redirected you too many times" (Chrome shows ERR_TOO_MANY_REDIRECTS). Browsers follow a limited number of redirects and then give up. A loop forms when, for example, the server sends http:// to https:// while a CDN or plugin sends https:// back to http://.

This article is for your own website. Typical triggers are installing an SSL certificate, adding a CDN, changing the domain, or turning on a redirect plugin.

Steps to fix it

  1. Clear cookies for the site only, then reload in a private window. If the loop disappears, a stale cookie was the cause and you can stop here.

  2. Trace the loop to see which addresses repeat:

    curl -sIL https://yourbusiness.in/ | grep -i -E "^(HTTP|location)"
    

    Or open the browser's developer tools (F12), choose the Network tab, tick Preserve log and reload. The Location values show the pattern, such as http to https to http, or from www to non www and back again.

  3. Check the CDN SSL mode if you use one. With Cloudflare, the Flexible mode connects to your server over plain HTTP; combined with an HTTPS redirect on the server, that loops. Switch to Full (strict) once your hosting serves a valid certificate. ODHOST shared plans include a free SSL certificate you can use for this.

  4. Fix WordPress URLs. In Settings > General, both "WordPress Address (URL)" and "Site Address (URL)" must use the same scheme and host, for example https://yourbusiness.in. If you cannot reach the dashboard, add these lines to wp-config.php above the "That's all, stop editing" line:

    define( 'WP_HOME', 'https://yourbusiness.in' );
    define( 'WP_SITEURL', 'https://yourbusiness.in' );
    
  5. Remove duplicate HTTPS redirects. Keep exactly one place that forces HTTPS. Candidates are:

    • cPanel Domains, the "Force HTTPS Redirect" toggle
    • cPanel Domains > Redirects
    • Rules in .htaccess (look for RewriteCond %{HTTPS} off)
    • A WordPress SSL or redirect plugin
    • In Plesk, the "Permanent SEO safe 301 redirect from HTTP to HTTPS" option in hosting settings

    A typical single rule in .htaccess looks like this:

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
  6. Align the www and non www versions. If WordPress says https://www.yourbusiness.in but a rule redirects www to the bare domain, they will loop. Make every setting use the same version.

  7. Handle proxies in code. If the site sits behind a CDN or load balancer that terminates SSL, WordPress may think the visit is HTTP. The WordPress HTTPS documentation shows how to read the X-Forwarded-Proto header in wp-config.php. Add it only if you are behind such a proxy.

How to confirm it worked

  • The curl -sIL command ends with a single HTTP/... 200 line.
  • http://, https://, www and non www versions all end up at your one chosen address.
  • You can log in to /wp-admin/ without being bounced back.

Once the loop is gone, check the padlock; if the browser still warns, see fixing "not secure" and mixed content.

If it still fails

Open a support ticket and include:

  • The URL and the output of the curl -sIL command, pasted as text
  • Whether you use a CDN or proxy, and its SSL mode
  • Your WordPress Address and Site Address values
  • Which redirect settings and plugins you have turned on
  • When it started and what changed just before (IST)

For other symptoms, see troubleshooting common hosting errors.

Frequently asked questions

Why does clearing cookies sometimes fix it?

Some sites set a cookie that decides where to send you, such as a language or login cookie. If that cookie is stale, the site can keep redirecting you. Clearing cookies for that one site removes it.

My site uses Cloudflare. What setting causes loops?

The Flexible SSL mode connects to your server over HTTP. If your server then redirects HTTP to HTTPS, the two loop forever. Use Full (strict) once your hosting has a valid certificate.

Should I use www or non www?

Either is fine. Pick one, set it in WordPress and in your redirect rules, and redirect the other version to it.

Can I fix it if I am locked out of wp-admin?

Yes. Define WP_HOME and WP_SITEURL in wp-config.php, which overrides the database values, or edit siteurl and home in the wp_options table with phpMyAdmin.

Sources and further reading

Contact us