When you open your website, instead of the hard worked front-end, you see a screen which tells you that you’re under an error of too many redirects or you are under a redirect loop. This can be pretty confusing for someone who hasn’t heard it before. But nothing to get worried! This is a common WordPress error and has an easy fix for it.
The too many redirects error is often known as a 310 error, or it shows up at times as a 404 Page Not Found error. In such cases, your browser has lost its path and is unsure about where to go. The reason for this is that the address you entered is pointing to more than one places and not to the right and proper place.
To fix this, the only thing to be done is to adjust the website URL settings. But depending on the exactness of the issue, they may be some work to be done. Here in this article, let’s look at what the error is, and apply some fixes for it.
Why Do I Get This Error?
The redirect error generally occurs when there is a misconfigured redirection issue. It is known that the SEO friendly structure of WordPress makes use of the redirect function. Some plugins also use this functionality. The WordPress SEO plugin lets you remove the category base from category URLs, redirecting the users to a URL without category base. Other plugins like WordPress SSL and cache plugins also make use of the redirects.
If any of these redirection tools are misconfigured, your website may end up redirecting users to a URL which in turn redirects them back to the referring URL. This traps the browser between two pages and it displays the error.
Fixing The Too Many Redirect Error
The home URL is the link your visitors should use to view your website in the browser. It is also called the Site Address for single installs of WordPress, which can be found under the General Settings in the Settings section in the dashboard. The site URL, which is also called the WordPress Address for single installs, is where the site and its core files are found.
If both these URLs aren’t properly inputted, or if there is any typo error, the redirect error will occur. Ideally, the home URL and site URL are the same, but they differ in some cases. The URLs should be entered without the slash at the end, and their structure should be consistent. The URLs should also start with http:// in front. If the home URL contains www., the site URL should as well, and vice versa. See the below example.
If you have different WordPress and site addresses, this may be the reason for the redirect error.
If you are not able to access the general settings, or if you have a multisite network, you will still be able to change the URLs to ensure that they are correct. You can add the following code to the wp-config.php file for hardcoding these values to the site/network.
define(‘WP_HOME’,’http://yourwebsite.com’);
define(‘WP_SITEURL’,’http://yourwebsite.com’);
(Your site’s name instead of http://yourwebsite.com)
Place both these lines above /*That’s all, stop editing! Happy blogging. */.
note that if you have a single install, you can’t change these addresses from your dashboard settings after adding these lines.
Restoring the .htaccess File
Do you remember updating your .htaccess file recently? If yes, this might be the reason for the too many redirects issue that occurred. Cross check the .htaccess file thoroughly to find any duplicate redirects or URLs which had gone wrong.
If you were not able to spot anything incorrect, download a copy of the .htaccess file and delete it from the server. Now, upload a fresh copy of the file with all customizations into the server. To find out the contents that should be in your new .htaccess file, visit the WordPress Codex .htaccess page.
Finally, upload the fresh copy of the file into your site, and visit the main page. If the page is loading fine, the issue was with the custom updates you made to the .htaccess file. Now, try adding the customizations one-by-one, until the site shows the redirect error again. When the error shows up, correct the last customization and reload the website. It will now be working fine.
Fixing Other Redirect Issues
If your too many redirect issue isn’t solved using the previous step, it should be assumed that this is an issue related to a plugin. As mentioned before, many WordPress plugins make use of the redirection option for various purposes related to their functioning. Let’s see how we can troubleshoot this issue.
Even though we assume that the issue is with a plugin, we don’t know which one. So, we have to find out which plugin causes the issue at first. Ask yourself the following questions: Have you recently activated any new plugins just before the error occurred? Have you had any plugins updated just before the error occurred? If you get a big ‘Yes’ for any one of these, narrow down those plugins and find the exact one. Quickly deactivate the plugin by deleting the plugin files from wp-content/plugins/.
If you are not able to find out the problem maker plugin, the only way left is a trial and error. Deactivate all plugins and backup a copy of the .htaccess file from your site’s root directory using an FTP client. Delete the .htaccess file from the server and refresh the website. Now, the server will automatically regenerate a new .htaccess file. Since all plugins are deactivated, the site will be running fine now, as the issue will mostly be fixed. This makes it clear that a plugin is causing the issue.
Now, we have to go ahead and find the culprit plugin. For finding it out, you will have to download and install the fresh copies of all the plugins again. Try activating the plugins one at a time. After activating each WordPress plugin, go back to your website and try loading some pages using a different browser and without logging into the admin panel. Continuing this way, you will perhaps find out the required plugin.
Wrapping Up
All of the above are the available and possible solutions which you can use to fix the ‘too many redirects’ error in your WordPress site. Using any of the above solutions, were you able to fix your issue? Is this the first time you are encountering the too many redirects error? If you have seen this before, which method did you use to solve the error? If that is a solution which isn’t included in the article, please let us know in the comment box. We always believe in updating the blog articles with new and improved information received in the future.
Have A Look At Our Top Rated WooCommerce Plugins ThemeHigh