Solution “load cannot follow 20 redirections”

Once I edited a lot of .htaccess files and noticed that one page stopped opening, and the logs had a message:

load cannot follow 20 redirections

I immediately checked the .htaccess file, I will give an example of the entries that were there:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^support\.ixnfo\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.support\.ixnfo\.com$
RewriteRule ^/?$ "https\:\/\/ixnfo\.com\/support" [R=301,L]
#RewriteCond %{HTTP_HOST} ^support\.ixnfo2\.com$ [OR]
#RewriteCond %{HTTP_HOST} ^www\.support\.ixnfo2\.com$
RewriteRule ^/?$ "https\:\/\/ixnfo\.com\/support" [R=301,L]

As you can see in the example, the domains support.ixnfo.com and www.support.ixnfo.com are being redirected to https://ixnfo.com/support, and for support.ixnfo2.com and www.support.ixnfo2.com I have commented out the rules but forgot to comment out the last line, resulting in repeated redirects.
After I commented out the last line, the error disappeared.

A similar error can also occur when many redirects are specified in the configuration of the Apache2 web server, nginx, etc., and it is also worth considering that redirects can be performed by web scripts, for example, the same WordPress redirects to the main page of the site that is specified in the admin panel, that is if the site address without www is specified in the WordPress admin panel, and in the .htaccess or web server configuration you specified the redirection of the main domain to the www subdomain, then a circular redirection will turn out and the page will not open.

It may also be such a situation that you just opened someone’s site and then the redirection parameters were changed on it, after which an error began to be displayed, to solve it, you need to clear the browser cache or wait a little.

ERR_TOO_MANY_REDIRECTS

See also my articles:
Information about using .htaccess
Redirecting requests to SSL
Redirect HTTP to HTTPS in Nginx

Leave a comment

Leave a Reply