Internet is an interconnected system of billions of webpages. Although it is not advisable to change the URL of a webpage —but sometimes it become necessary to do redirect from one URL to another URL. And, at times, this innocuous redirection causes an annoying problem that reads “This Webpage has a redirect loop”. Technically, by the browsers like Chrome and Mozilla Firefox, this error is shown as “Error 310 (net::ERR_TOO_MANY_REDIRECTS): there were too many redirects”. Sometimes this error comes up even when we try to access our Gmail account.
Today I will tell you how to solve the redirect loop problem. Solution for this problem is not at all difficult. Let’s begin with understanding the concept of webpage redirection and why do redirect loops occur.
Let’s assume you are running a website or a blog on a particular domain name. Now because of some unavoidable circumstances, you have to buy a new domain name and shift your website onto the new address. Obviously, this will cause change in the URLs of your webpages.
Google does not like a change in the URL and also your visitors will not be able to easily reach the new address. To get around this problem, a 301 redirect code is used which makes old URL automatically redirect to a new URL. Such a redirection can be done using an .htaccess file.
When you redirect one URL to another —this should be a linear flow. But at times we unknowingly complicate the matter by doing too many redirects and thereby inadvertently causing a loop.
Redirect loop is like a situation wherein “A points to B and B points back to A”. Such a redirection will keep browser in an infinite loop and the webpage will never be displayed. In old times, such redirect or infinite loops used to result in a hung browser.
Thankfully, modern browsers are able to detect such redirect loops and they break the cycle by displaying an error message: “This Webpage has a Redirect Loop”.
It’s not that this error comes only when there is a cyclic loop. If a webpage has too many redirects (for example, A points to B; B points to C; C points to D… and so on); in such a situation as well browsers will show the redirect loop error.
Browsers, like Google Chrome and Mozilla Firefox, show this error as:
“Error 310 (net::ERR_TOO_MANY_REDIRECTS): there were too many redirects”.
This problem may be caused either at the client end or the server end. If there is no redirection loop on the server side, the problem is likely to be solved just by deleting cookies.
Solve Problem by Deleting Cookies
Open the browser that is showing this error. Here we will take Google Chrome as example.
Click on the menu button given in the top-right corner.
From the resulting drop-down menu, select Settings
Chrome will open your personal browser settings in a new tab
Type “cookies” in the search box. Chrome will look for all the setting options where the word “cookies” appear.
Click on Clear browsing data… button. A new box will come up. Now select Cookies and other site and plug-in data.
Click the Clear browsing data button.
Close your browser and start it again.
Now go to the URL that was showing the redirect loop error. The error should be gone now and you should be able to view the desired webpage.
Check Your htaccess File
After deleting cookies, if the error is still there, it is most likely a problem with the webpage and as a visitor you can’t do anything about it.
If you’re a visitor, you can try to visit the same URL in another browser. If more than one browsers are showing the “This Webpage has a Redirect Loop” error, it is most likely to be a server side issue.
If you’re a developer who is facing redirect loop problem, I would recommend that first of all you check your .htaccess file. Look for any cyclic or too many redirection codes. Try to keep your htaccess file in a clean state because if this file will become confusing, it can really break your website.
BONUS TIP: If you’re having login problem on a website, enabling cookies on your browser might be useful.
I hope this information would help you in solving the problem. If you have any queries, please feel free to let me know through the comments section on this article. I will try to assist you. Thank you for using TechWelkin.