This problem manifests itself in a few different ways:
- You are unable to log in to WordPress as you are constantly brought back to the WordPress login page despite having entered the correct login details. (Note: with this issue you are not provided with an incorrect login notification -- if you see this notification then this is not the same problem)
- When visiting a page nothing shows up. Your browser might indicate that it is redirecting too many times or that there is a redirect loop. Safari says: "Too many redirects". Firefox says "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
- Visiting any page of your site results in a 500 Internal Server error and the Plesk log viewer shows an error about too many redirects reaching the max of 10.
This means that a redirect is configured in one spot that directly opposes a redirect configured elsewhere, creating a conflict between the two..
The most common configuration with this type of conflict has to do with your preferred domain. There are a few variations for every URL that boil down to whether or not your website's URL uses HTTPS and whether or not it uses www. For example here's 4 different combinations of the Websavers URL:
For Websavers, we chose https://websavers.ca as our preferred URL: you'll need to pick one too!
Now that you have chosen your preferred URL, the best way to resolve this problem is to ensure you've configured that URL to be the same everywhere: both in Plesk and in your web application's configuration (and possibly in your plugin configurations too, depending on your choice of plugins). Here's how
- Begin by logging in to Plesk
- Head to the Websites & Domains tab
- Scroll down to the domain you're having this problem with and click the link to the right of the domain that says "Hosting Settings".
- The "Preferred Domain" setting will control the www and non-www preference, and the option called "Permanent SEO-safe 301 redirect from HTTP to HTTPS" will enable HTTPS. Set these values to match your preferred URL.
- Select "1-click web apps" and click the wrench icon beside the site you're working on. Look for your URL in the list of settings and change it to ensure it matches your preferred URL. This will reconfigure WordPress to use your preferred URL without having to go into the WordPress settings.
Your browser will have probably cached the redirect, so even after making these changes, loading the site in your browser may still display the same error. When testing this solution, be sure to either try a different browser or clear your browser cache after each change you make to resolve it. You can also disable your browser cache during testing.
Solution 2: .htaccess entries
This issue can also occur when you have conflicting .htaccess entries, or other redirects that conflict with each other (like WordPress redirects plugin, or nginx redirects). Check your .htaccess file, save a backup of it, and then revert it to defaults (at bare minimum for testing) to see if it solves the problem. If it does either leave it at default or try to pinpoint the redirect error in your customized .htaccess file.
Check your plugin configurations, particularly if you have any redirection plugins or a plugin like Really Simple SSL that can be configured to force HTTPS or non-HTTPS. It's often best to disable these plugins entirely to see if it solves the problem before attempting to narrow down particular configurations within the plugin's settings that are causing the issue.