Black Friday hosting deals · every offer with its renewal price

// wordpress & cpanel how-tos

This webpage has a redirect loop in WordPress: how to fix "too many redirects"

A redirect loop isn't easy to solve when you're new to blogging or setting up a site for the first time. But once you look at your site settings, you'll usually find the cause in minutes.

What "this webpage has a redirect loop" means

When you open a page with this problem, the browser shows an error instead of your site. Chrome says the page "redirected you too many times" (ERR_TOO_MANY_REDIRECTS); Firefox, Safari and other browsers show a similar message about too many redirects.

The problem is that several versions of the same address redirect visitors to each other: www to non-www and back, or http to https and back. None of them can load, so the browser goes in circles and gives up. It often appears right after you move your site to a new server and miss a setting, for example when the old install used "www" and the new one doesn't. A broken .htaccess file or a wrong rule inside it can cause it too.

2. Make your site address match

If you changed your blog address with or without "www", or between http and https, WordPress and your server may disagree about the right address. Set it explicitly: in cPanel, open File Manager, edit wp-config.php and add these two lines above the "That's all, stop editing!" line:

define( 'WP_HOME', 'https://www.yourdomain.com' );
define( 'WP_SITEURL', 'https://www.yourdomain.com' );

Use the exact address your site should have. If you can't find how to edit the file, follow my guide to fixing the WordPress URL from wp-config.php. Then check that your host or .htaccess doesn't force the opposite version (for example, a rule sending www to non-www while WordPress wants www).

3. Check your CDN and SSL settings

When I first wrote this guide, a common cause was Google's PageSpeed Service, which cached your pages and kept sending visitors to an outdated copy. Google shut that service down years ago, but CDNs cause the same kind of loop today.

The classic case is Cloudflare. If its SSL/TLS mode is set to Flexible, Cloudflare talks to your server over plain http, your server (or a plugin) redirects to https, and the loop starts. In the Cloudflare dashboard, set SSL/TLS to Full (strict) when your host has a valid SSL certificate, which almost every host provides for free now.

4. Clear every cache

After any fix, clear all the caches between you and your site, or you may keep seeing the old redirect: your caching plugin (WP Rocket, LiteSpeed Cache, W3 Total Cache and others all have a purge button), your host's server cache, your CDN cache, and your browser's cookies and cache for the site. Then test in a private window or another browser.

If the loop started after you installed a plugin, especially a redirect, SSL or security plugin, disable it by renaming its folder in wp-content/plugins and test again.

FAQ

What causes ERR_TOO_MANY_REDIRECTS in WordPress?

Usually two settings that redirect to each other: www versus non-www, http versus https, a wrong .htaccess rule, or a CDN like Cloudflare set to Flexible SSL while your server forces https. A cached redirect can keep the error alive after you fix it.

How do I fix a redirect loop if I can't log in to WordPress?

Use cPanel's File Manager: rename .htaccess to reset the rewrite rules, and set WP_HOME and WP_SITEURL in wp-config.php to your correct address. Then clear your caches and log in again.

Which Cloudflare SSL setting stops the redirect loop?

Full (strict). With Flexible, Cloudflare reaches your server over http, your server redirects to https, and the browser loops. Full (strict) needs a valid certificate on your host, which most hosts give for free.

Keep reading

WRITTEN BY

Fathi Arfaoui

Fathi Arfaoui has helped people choose web hosting, start blogs and build WordPress sites since 2013. He founded SiteHostingFinder to replace opinion-based hosting reviews with real prices and public data. He has been a HostGator customer since 2013 and has hosted 40-50 WordPress sites on Pressable since 2017.