“Too many redirects,” also known as a redirect loop, is an error the browser will return if the requested web page fails to load due to an endless number of redirects it has to follow to retrieve any content from the server. Redirect loops can often be caused by conflicting redirects on the server side or a CDN misconfiguration.
In this comprehensive guide to fixing the “Too many redirects” error, you will learn where redirects can be configured, what the most common reasons behind redirect loops are and how to address them in a step-by-step manner.
What Are Redirects and How Do They Work?
Website redirects can be defined as the steps that need to be taken during the content delivery to find the location of the requested web page. While, for you, it might seem like the change achieved with a redirect rule only reflects how the website’s address is displayed in the address bar, your browser performs a series of operations behind the scenes to determine where each redirect leads before it can load any content from the final location defined by the redirection path.
Forcing HTTPS, the www version of a website, or loading another domain name — redirects are widely used in website hosting, allowing you to customize content delivery. There are multiple ways to set up domain redirects, and as long as they are configured correctly, browsers will not have any issues following the rules you have created.
Temporary and Permanent Redirects
There are two main types of redirects that can be configured — temporary and permanent. Depending on the type of redirect encountered, the web server will return either the 302 or the 301 HTTP status code.
A 302 HTTP response code shows you that a specific web address is temporarily redirected to another location. However, sometimes you can see that a temporary redirect is followed when you have removed a permanent redirect rule from your website, but haven’t flushed its cache, which prevented the changes from being visible.
This can happen if you are using a caching solution of any kind, including one of the WordPress caching plugins. Your browser will also store a cached version of any website you visit, which will include old redirects.
Permanent redirects return the 301 HTTP status code and indicate that your website or a certain page on it has been permanently moved, which, in case it is a redirect to HTTPS or the www version of the website, does not necessarily mean that its location on the file system has changed.
What Are The Most Common Redirects?
Redirects from the HTTP to HTTPS web protocol and from the non-www
This article was written by Kiki Sheldon and originally published on WordPress News | iThemes Blog.