WordPress Hosting Tips: The too many redirects issue: How to fix it
There are many benefits of running a self-hosted WordPress.org website, but there are also some easily solvable errors that can be repulsive for beginner users. The most common errors are the white screen of death, internal server issues, and other small but equally stressful problems.
Not so long ago, a user pointed out a “too many redirects” error in WordPress. It is a common problem that people using the platform are coming facing. If you are using Firefox, we have to point out that this error will display like this:
“The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”
It is also known as 310 error, but sometimes it can appear as the famous “404 page not found”. What does that mean? It indicates the browser does not know where it is supposed to go or cannot reach your site.
This is usually happening because the entered address points to too many places, or not at the right one.
A quick fix would be to adjust the URL settings for your site, but if that does not help, you may have to do something fancier which we will talk about below.In his text, we will explain and show you how to fix the “error too many redirects” issue.
What does “too many redirects” mean?
Error 310 or “too many redirects” is a typical WordPress issue caused by improper use of URL redirects.To create SEO friendly structure, WordPress has enabled URL redirection function which many webmasters use to redirect the old URL to a new one with a plugin.
But if the old URL is not redirected to a unique location, the 310 error will appear.
Too many redirects and redirect loop
When you set up your site or network, open your browser and type in your address, your site loads because the URL is leading it to your desired web page. However, if the typed address points to different locations in your settings and they are not matching, the browser does not know which place is the right one.
Then, the browser will attempt to determine it, and if it is unsuccessful, it times out, and displays “error too many redirects” – meaning your site is pointing to more than one location.
Alternatively, it can display that the address you are trying to reach is in a redirect loop. What is a redirect loop? If the page has a redirect loop, it means that the address points to your WordPress page, but the page points to a different address which then leads back to where you started, and so on – catching your browser in a loop.
I got caught in a loop, what now?
Usually, as we said before, these error messages appear because of a configuration issue in your settings. These problems are rarely complicated than that. Here are the five common reasons why these error messages are displayed:
- Home and/or site URLs are incorrect and/or different.
- Your site is redirected to because of a misconfiguration in an installed plugin.
- There is an issue with custom changes to the .htaccess file.
- There is a new site in your network that has the same URL as a deleted site.
- There are multiple sites or networks that you are hosting using only one IP address.
When you look at the list, you can see how one small mistake or misconfiguration can break your website and cause too many redirects in WordPress. Checking these common issues off your list is the first step toward fixing the problem.
The page redirected you too many times. No more!
So, the most common issue that people usually come across is when a user has the wrong URL in WordPress address URL or site address URL settings.
Here is an example: your site’s URL is “http://www.dontredirect.com”, and you click on “Settings”, then “General”, and set it to “http://dontredirect.com”. Now, the vast majority of web hosts will allow you to choose between having the “www” prefix in your domain name, or not without having it.
If you had elected to have “www” prefix, typing “http://dontredirect.com” in your WordPress settings would cause too many redirects to occur. This error will also happen if you opted for not having the prefix and you typed “http://www.dontredirect.com” in your settings.
This page has a redirect loop in that case because the user will come to “http://dontredirect.com” and your server’s configuration will direct him to “http://www.dontredirect.com”, which will redirect him back to step one and so on and so forth.
Now, if your site was working fine for a while and you did not apply any changes to the said settings, you will need to contact your web host as the configuration issue might be at their end.
That is why it is essential to have a reliable and trustworthy WordPress hosting provider. If they deny having any configuration problems and are not willing to help you, then consider changing the host or fixing it yourself.
Also, you already know how to do it! Here is a quick reminder:
To make sure your WordPress address and site address is the same, go to “Settings”, and “General”. If they do not match, change one. Always make sure that you do not instinctively type a trailing slash (“/”) symbol at the end of your URL.
How do I change the website URL without having access to the admin area?
If too many redirects occurred and you do not have access to the WordPress admin area, do not worry, there is still a way to solve it. The setting changes that we covered can be updated by defining them in the wp-config.php file.
All you have to do is to connect your website using an FTP client and find the wp-config.php file in your site’s root directory. Then, download and edit the file using a text editor (we suggest Notepad).
Add these two lines and don’t forget to replace dontredirect.com with your domain:
define(‘WP_HOME’,’http://dontredirect.com’);
define(‘WP_SITEURL’,’http://dontredirect.com’);
Apply and save changes, and upload the file back to the web server. After all that is done, try to access your site. If you still can not reach it and there were too many redirects occurring, then try adding the “www” prefix to your domain.
Other known redirect issues
So, you accessed your website, and again there were too many redirects. If your WordPress URL and site URL is matching, then there might be a plugin issue with your site. It is known that several WordPress plugins use redirection methods to do a variety of things.
Let us try and solve this problem together.
First, you have to find out which plugin is causing too many redirects. Did you install a new plugin or update the old one right before the error happened?
If the answer is yes, then it narrows it down. Just deactivate the plugin by deleting its folder from “wp-content/plugins/”.
However, if the answer is no, then you would need to do some trial and error. The fastest way to do that is to deactivate all plugins, download the .htaccess file as a backup using FTP. Next step is to delete .htaccess file from your server and try to access your website.
This way your server will create a new .htaccess file which will fix the issue because now there are no plugins activated. If this method fixed the problem, then you know for sure that a plugin was causing it. Which one is it?
To figure this out, you need to download and install all of your plugins and activate them one at a time. Every time you do that, try to browse your websites’ pages using a different browser.
That way, when the site breaks, you will know which plugin caused the redirect loop.
Ending thoughts on too many redirects:
As you can see, it is simple to fix too many redirects in WordPress when you understand what that error is. More often than not it is a result of human error, but if that is not the case, you now have the knowledge to fix it.