Have you ever been irritated by various common WordPress errors like Internal Server Error, Error Establishing a Database, White Screen of Death, and so on? Among those issues, the “Too Many Redirects” error is selected in the following guide to brief you on several valid solutions for this error as well as show you the reasons that result in such embarrassing situation.
If you are the one who suffers a lot of the Too Many Redirects error, you just need to refer to the given methods and then deal with the issue without striking a blowing. Since many readers lack understanding of such WordPress error, we would like to make a brief introduction about it at first.
What Is Too Many Redirects Error & Why You Get This Error?
Too Many Redirects error, also called error 310, is a common WordPress error caused by the improper use of URL redirects as its name suggests. Since WordPress enables URL redirection function for all users to create SEO-friendly URL structure, many webmasters tend to make use of this function to redirect the old URL to a new one by means of a redirect plugin.
Note that, one old URL must be redirected to a unique location. If not, the Too Many Redirects error happens to you naturally. That is to say, if you redirect an old post to two locations, your visitors cannot access to the redirected page and what comes to them is like the following screenshot or a 404 not found page.
In some cases, one of the main reasons that results in such issue is the misconfiguration of an active redirection plugin, which has your visitors caught in a dilemma and increases the bounce rate as well. Fortunately, this step-by-step guide makes it easy to solve Too Many Redirects error.
Common Reasons for the Too Many Redirects Issue
Surely, there are a lot of reasons that may result in this error, and we have listed the most common ones in the following.
- You have entered the incorrect and different Home URL and Site URL.
- Some of your plugins might come with the wrong configurations and redirect your pages in the wrong way.
- There are some improper changes made on your .htaccess file.
- There are multiple websites or networks hosted on a single IP address.
- Your site uses the same URL as that of a delete one.
After learning the causes, now, you can check some methods for addressing this issue from the below parts.
How to Fix Too Many Redirects Error?
Before everything, you are required to log into your WordPress dashboard and go to Settings > General to check if there is something wrong with the WordPress Address or Site Address.
In some cases, there is no difference between adding a www prefix to the URL and not doing so. That is to say, it leaves to your option. However, if your web host has limited your choice and only allows you to select one way to go, then you need to ensure that you set your URL address by the rule. If not, that will become the main cause to the Too Many Redirects error.
If everything goes well and there is no change after resetting the URL address, you need to refer to the following solutions. Perhaps, contacting your WordPress hosting provider to ask for help is also a good option for you.
Here, we are going to show you three methods to fix Too Many Redirects error effectively, which require you to add lines of command to wp-login.php file, wp-config.php file and PHPMyAdmin.
Modify wp-login.php File
Open your wp-login.php file after connecting your website with an FTP client. Since we create and manage our website by means of cPanel, we will complete all processes via this powerful control panel. Log into cPanel and target Files > File Manager. In general, the root access of wp-login.php should be /public_html/wp-login.php. If you install WordPress on a subdomain, then the root access should be /public_html/subdomain/wp-login.php.
Seek the wp-login.php file from a list of items and right click it to “Edit” it in an editor. And then, add the following command to this file and replace the yourwebsite.com to your own website domain. Finally, “Save” the file to confirm all settings.
//FIXME: do comment/remove these hack lines. (once the database is updated) update_option(‘siteurl’, ‘http://yourwebsite.com/the/path’ ); update_option(‘home’, ‘http://yourwebsite.com/the/path’ );
Keep in mind that since you have successfully fixed the Too Many Redirects error, you need to remove the command mentioned above from wp-login.file.
Modify wp-config.php File
The second method to solve Too Many Redirects issue is making a change to your wp-config.php file which is regarded as the core file in WordPress. Open this file in an editor by complying with the way to open the wp-login.php in cPanel. Likewise, the root access of wp-config.php should be /public_html/wp-config.php or /public_html/subdomain/wp-config.php.
And then, add the following lines to this file. You are required to replace yourwebsite.com to your site domain. “Save” the file to bring the command into effect. Note that, once the following lines come into force, you cannot make any change to the address URL via your WordPress dashboard > General > Settings.
Make Use of PHPMyAdmin
Making a change to your database is also regarded as a valid solution for Too Many Redirects error. Perhaps, you can reach the target by using PHPMyAdmin that is a great tool for the administration of MySQL database. Here, we would like to proceed to the following process via cPanel. Log into cPanel and go to Databases > phpMyAdmin.
When you have successfully accessed to the PHPMyAdmin interface, you need to add the given command to SQL tab and then replace the yourwebsite.com to your own site information.
UPDATE wp_options SET option_value = 'http://yourwebsite.com' WHERE option_name IN ('home', 'siteurl');
If You are Using a URL Redirect Plugin
Since all methods mentioned above cannot do anything for you, then you should check if there is something wrong with your plugin especially for the URL redirect plugin that are activated on your website. Here, we would like to take the Redirection plugin as an example, which enables you to create URL redirect in a simple manner.
If you have redirected the URL http://www.yourwebsite.com /1 to another URL http://www.yourwebsite.com/2, and then you redirect the second URL to the first one since you have forgotten about the previous redirect. In this way, the Too Many Redirects error occurs to your website naturally and the page should be like the following screenshot if someone visits one of the URLs.
In this situation, you should delete one of the redirects immediately and check if there are some similar mistakes happening on your website.
If you are using multiple plugins on your website and cannot make certain which plugin goes wrong, you should deactivate all plugins and update them all at once. And then, activate those plugin one by one. Each time you do that, you need to browse your website to check if there is a Too Many Redirects error. We hope that such a strict method can help you troubleshoot the root of the problem as soon as possible.
If you can access your website admin, this method can be done easily just via the Plugins section. However, if the admin panel is inaccessible, you should remove the faulty plugins using your FTP client. Here, we have listed the simple steps in the following.
- Open your FTP and start the connection with the root folder of your WordPress site.
- Move to the wp-content/plugins/ folder.
- Rename it or directly delete the whole folder. This can cause the removal of all the plugin installation.
Restore Your .htaccess File
In some cases, the redirection issue might occur after you make some changes to the .htaccess file. Due to this, you’d better check this file to figure out whether your updated settings are something wrong. If you cannot spot any mistake, you can restore this file to the default value by following the below steps.
- Copy and backup the .htaccess file firstly.
- Delete the current version.
- Log into the WordPress dashboard and click Settings > Permalinks.
- Click the Save Settings button to have a new .htaccess file generated automatically.
Now, you can check whether the redirection error happens again on your site. If not, you can add the changes made on the .htaccess file one by one until you find the culprit.
Clear all Your Current Cookies and Cache
Sometimes, you may have already fixed this issue after carrying out the above-mentioned practices. However, the changes will come into effect only when you clean up all the cache and cookies. After all, to have your site loaded quickly, there will be a static website copy saved by your browser or your WordPress cache plugin temporarily. In this case, any new change or update may fail to be reflected until these copies are removed, indicating that your site is under a new copy now.
Choose to Use the Dedicated IP Address
In fact, the domain name can be viewed as the online address, which is connected to an IP address of where your website is hosted. In this case, when your domain is entered into the browser address bar, it will connect to the corresponding IP address automatically, and then, direct the online users to the right place.
Ideally, each site is connected to an exclusive IP address. However, if you have multiple sites hosted altogether using a single IP, the correct redirection might be broken.
At this point, you can try to upgrade to the dedicated IP address to fix the too many redirects issue, especially when you install and manage the WordPress Multisite Network only using one IP with the shared web hosting solution.