How to Fix “Too Many Redirects” Error Messages

Website redirect issues can disrupt user experiences, hurt search engine rankings, and even lead to broken links. Whether you’re managing a small blog or a large e-commerce site, addressing these problems promptly is essential to maintaining both functionality and user trust.

There are lots of ways this can happen, even when the most common is the dreaded “Too Many Redirects” error a browser can give. In this how-to guide, we’ll focus on showing you how to diagnose the most common causes of this and how to fix them.

Identifying the Cause

Redirect problems can occur due to problems in your code, the configuration of your Bolt, or even the settings used by your CDN. To find the quickest way to solve the problem, you’ll first need to determine what is causing it. There are multiple ways to troubleshoot redirection issues, but in this guide, we’ll focus on two key methods: using your browser’s developer tools and the command line.

Method 1: Using Your Browser  

First, you need to open up your browser in incognito mode. This ensures that you don’t look at local cache, negating problems on your end. Once this is done, open the console and navigate to the network tab. Once this is opened you can open the page we are having issues with. In the network tab, you should now see the requests our browser is making. You can compare two (or more if needed) requests to see where the redirects are taking us and more importantly: what is setting this redirect.

Overview of the browser console showing a loop of redirects.

To do this, click on one of the requests, and take a look at the HTTP headers being sent. We are interested in two headers, the “Location:” header and one that can vary depending on where the redirect was set. It could be “Server:”, “X-Redirect-By:”, etc.

Example of a set of HTTP headers shown in the browser.

Method 2: Using Command-line

Every modern OS comes with a command line tool called cURL. This can be used for various things, but in this case we’ll be using it to fetch the HTTP headers sent by your website. We do this by utilising the -I flag, like this:

Example of HTTP headers showing in the console.

Again, we are looking primarily for the “Location:” header and secondarily for an indication of where the redirect is coming from. If needed, you can repeat this process like in an actual redirect loop.

Keep in mind that while the “Location: header will always be correct, the origin of the redirect might not always be that clear. But most plugins or servers are likely to leave some trace behind in these headers that give you a clue on what happened.

Fixing That What Is Broken

Now we know which redirects are in place and leading to a loop and, hopefully, also where these are being made. We can now proceed with fixing them, by removing one of the redirects that form the loop. This can be done in multiple places, but its always best to keep the redirect as close to your visitor as possible. These are some common ways to address the loops.

Redirect Loops Caused by Cloudflare Settings

If you are using Cloudflare with the self-signed certificate option, you need to make sure that SSL/TLS is set to Full in Cloudflare. Setting it either to Flexible or Full (strict) may then sometimes cause redirect loops.

Overview of recommended settings in Cloudflare.

Loops Caused by the Server Configuration

In the Servebolt Admin Panel:

1. Check the redirect settings for your site.

2. Ensure all redirects point to the same HTTPS domain.

3. Verify there are no conflicts between HTTP/HTTPS and www/non-www URLs.

Overview of the Redirect settings in the Servebolt Admin Panel.

And, make sure your .htaccess file matches the default as closely as possible:

# BEGIN WordPress
RewriteEngine On

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Loops Caused by Your WordPress Configuration

Discrepancies in the home and site-URL used by your WordPress configuration can cause it to keep redirecting between the two. There are a few locations you can check if this is indeed the case:

In the `wp-config.php` file, you can check if you have one or both of these statements set:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

If both are defined, they should usually be set to HTTPS://yourdomain.com. The exact hostname doesn’t matter, as long as they are identical.

If these values are not defined (which is the default), they are stored in your database. Go to your Admin Panel, and under the database tab, you can find a link to phpMyAdmin.

The login credentials to your database can be found in an email sent to the Bolt owner when creating a site/database. Alternatively, these credentials can be found in your database configuration file. For WordPress, this configuration file is typically located in the following file path: ~/public/wp-config.php.

When you are logged in, navigate to the table where the site and home URLs are stored.  

In WordPress, this is stored in the table called wp_options, and under option_name you will find the value siteurl and home.

Example of the option_value in phpMyAdmin.

If they need to be updated, you can double-click on the option_value you want to change. Right after that you can set the value you need.

You can also use WP-CLI with SSH by running this command in the ~/public directory.

# For site URL

wp option get home

# For home URL

wp option get home

Updating can be done using the following command. Simply replace the option with the option you want to update and the value to what you want to set it to:

# Update option

wp option update <option> <value> 

In all situations, if the redirect loop was caused by this, the problem should now be solved.

Loops Caused by Plugins

Ideally, we’ve already found which plugin is causing the redirection issue. Deactivating it through the WordPress admin fixes your issue and gives you more time to troubleshoot what exact setting in the plugin is causing the behaviour.

If you are not able to login to your WordPress backend, here is an alternative solution. This will also work if you don’t know exactly what plugin is causing your problem. It requires you to either login to your site using SFTP or SSH

Now that you are logged in, you can navigate to your wp-content folder. The standard path is: ~/public/wp-content/

This is where you find the folder “plugins”, renaming the plugins folder will deactivate all plugins on your site. When that is done, refresh your website and see if that helped. If it did, then there is a plugin that is causing the redirection loop. To figure out which plugin it was, you can log in to your WordPress backend and go to your plugins. If you see the empty list (i.e. no plugins present) rename the plugins folder back to it’s original name. Now activate them one by one until you find the plugin that was causing the issue.

Conclusion

After reading this you should be able to diagnose what causes redirect issues on your website and how to fix them. If you want to read up on similar articles, you could consider learning more about the redirect options our Admin Panel offers. Also, our explanation on different types of redirects could be a useful addition to read.