Symptoms
-
When trying to open a website
example.com
in a browser, the following error is shown:ERR_TOO_MANY_REDIRECTS
-
Sometimes error starts occurring after enabling Google PageSpeed.
-
Redirect checkers like redirect-checker.org shows that
example.com
is redirecting towww.example.com
and back again.
Cause
Redundant redirects lead to an infinite redirect loop.
Resolution
Such an issue can occur if redirect is already configured in the.htaccess
file, in Apache &Nginx Settings, or in the web application's (e.g. WordPress, Joomla) settings.
To fix the issue it is required to disable redirects in Plesk:
-
Log in to Plesk.
-
Navigate to Domains > example.com > Hosting Settings.
-
Change Preferred domain value to
None
and click OK: -
Remove redirect rules under Domains > example.com > Apache & Nginx Settings, if any.
-
Remove redirect rules in the
.htaccess
file like the following:Redirect 301 /index.html http://www.example.com/
Additional information
Note: The number of redirections can be checked with the commands below. If result <4, redirections are fine:
-
For a specific domain:
Note: change the "example.com" domain in the command below to the correct one.
# curl -s -k -L -I example.com | grep -E '301|302' | wc -l
-
For all the domains:
# plesk db -Ne "select name from domains" | xargs -i sh -c 'printf "{} " && curl -s -k -L -I {} | grep -E "301|302" | wc -l'