When trying to open a website
example.comin a browser, the following error is shown:
Sometimes error starts occurring after enabling Google PageSpeed.
Redirect checkers like redirect-checker.org shows that
example.comis redirecting to
www.example.comand back again.
Preferred domain value is set to
www.example.comat Plesk > Domains > example.com > Hosting Settings.
Redundant redirects which lead to infinite redirect loop.
Such issue can occur if redirect is already configured in
.htaccess file, in Apache &Nginx Settings or in web application (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
Noneand click OK:
Remove redirect rules under Domains > example.com > Apache & Nginx Settings, if any.
Remove redirect rules in the
.htaccessfile like the following:
Redirect 301 /index.html http://www.example.com/
Note: 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:
# for i in $(plesk bin domain –list); do echo $i && curl -s -k -L -I $i | grep -E ‘301|302’ | wc -l; done