Kiến Thức Linux

How to Troubleshoot ERR_TOO_MANY_REDIRECTS

Introduction

Redirection is the forwarding of one URL to another URL. Redirects are useful when moving content from one page to another or changing a website’s permalink structure.

The ERR_TOO_MANY_REDIRECTS error occurs when the browser is redirected to a different URL, which in turn points back to the original one, creating a redirection loop. There are several possible reasons for the error and several available fixes.

In this tutorial, you will learn what causes the ERR_TOO_MANY_REDIRECTS error and how to fix it.

How to troubleshoot the ERR_TOO_MANY_REDIRECTS error.

What Does “Too Many Redirects” Mean?

The ERR_TOO_MANY_REDIRECTS error indicates that the browser is stuck in an infinite redirection loop. An infinite redirection loop happens when you visit a URL pointing to another URL, which points back to the first one.

After several redirects, the browser breaks the redirection loop and displays the “too many redirects” error message. Different browsers warn users about the error in different ways. Most browsers display a “too many redirects” warning and suggest how to fix the error.

Below are several variations of the error, depending on the browser:

Too Many Redirects Chrome

Google Chrome states that the page isn’t working and suggests clearing the cookies might help.

The ERR_TOO_MANY_REDIRECTS error in Google Chrome.

Too Many Redirects Firefox

Firefox explains that the page isn’t redirecting properly and states that cookies might be causing the issue.

The ERR_TOO_MANY_REDIRECTS error in Firefox.

Too Many Redirects Safari

Safari explains it cannot open the page because of too many redirects.

The ERR_TOO_MANY_REDIRECTS error in Safari.

Too Many Redirects Edge

Microsoft Edge states that the domain redirected you too many times and suggests clearing the cookies to fix the issue.

The ERR_TOO_MANY_REDIRECTS error in Microsoft Edge.

Most browsers suggest that cookies might be the reason for the ERR_TOO_MANY_REDIRECTS error. The following section explains this and other possible causes for the error.

err_too_many_redirects Causes

There are several possible triggers for the redirection loop. The following list includes the most common causes of a redirection loop in a WordPress website:

  • Issues with the browser’s cache/cookies. The browser may be caching faulty data that leads to the redirection error.
  • The browser extensions. Sometimes a browser extension can cause a redirection error.
  • The website’s URL. A misconfiguration in URL settings can cause the redirection error.
  • WordPress cache. The website cache could be causing a redirect loop.
  • SSL certificate. A misconfigured security protocol (SSL certificate) can cause a redirect loop.
  • Third-party services and plugins. A faulty WordPress plugin could be causing the redirection loop.
  • The site’s .htaccess file. A user-level configuration file WordPress uses to rewrite URLs to the index.php file. The website URL is defined as a value in the database.

How to Fix Too Many Redirects – Troubleshooting

Before fixing the “too many redirects error,” ensure that the page is down for everyone, not just for you. Many online free tools identify redirect loops. Some of the tools are:

The solution to the “too many redirects” error depends on whether you own the website in question or not. If you don’t own the website, follow our instructions below to clear browser cookies and cache, or try accessing the site in incognito mode.

If you are the website owner and get a “too many redirects” error, further actions are available to fix the site’s redirection loop.

Clear Cookies and Cache on Your Browser

Clearing the browser cache and cookies is a quick and straightforward solution worth trying before diving into more complicated troubleshooting.

Clear Cache and Cookies in Chrome

Follow the steps below to clear the cache and cookies on a Chrome browser:

1. In Chrome, press Ctrl + Shift + Delete to open the Clear browsing data window.

2. In the Time range dropdown menu, select All time.

Selecting the time range for clearing browsing data in Chrome.

3. Check the following boxes:

  • Cookies and other site data.
  • Cached images and files.

Uncheck any other boxes.

4. Click the Clear data button to clear the cache.

Clearing the browsing data in Chrome.

5. Revisit the webpage to see if the error is gone.

Clear Cache and Cookies in Firefox

Follow the steps below to clear the cache and cookies on a Firefox browser:

1. In Firefox, press Ctrl + Shift + Delete to open the Clear Recent History window in Firefox.

2. In the Time range to clear dropdown menu, select Everything.

Selecting the time range for clearing browsing data in Firefox.

3. Check the following boxes:

  • Cookies.
  • Cache.

Uncheck any other boxes.

4. Click the OK button to clear the cache and cookies.

Clearing the browsing data in Firefox.

5. Revisit the webpage to see if the error is gone.

Clear Cache and Cookies in Edge

Follow the steps below to clear the cache and cookies on a Microsoft Edge browser:

1. In Edge, press Ctrl + Shift + Delete to open the Clear browsing data window.

2. In the Time range dropdown menu, select All time.

Selecting the time range for clearing browsing data in Edge.

3. Check the following boxes:

  • Cookies and other site data.
  • Cached images and files.

Uncheck any other boxes.

4. Click the Clear now button to clear the cache and cookies and revisit the webpage to see if the error is gone.

Clearing the browsing data in Edge.

Clear Cache and Cookies in Safari

Follow the steps below to clear the cache and cookies on a Safari browser:

1. In Safari, press CMD + , to open the Preferences window.

2. In the Privacy tab, click the Manage Website Data button.

Managing website data in Safari.

3. In the popup window, click the Remove All button to delete all cache and cookies data. Alternatively, find only the cache and cookie data for the website displaying the error and click Remove.

Clearing cookies and cache in Safari.

4. Click Done and revisit the webpage to see if the error is gone.

Note: Learn how to properly implement a PHP redirect.

Check Website in Incognito Without Extensions

Ensure that the extensions the browser is using aren’t causing the error by visiting the website in incognito mode (private browsing). Follow the steps below to enter incognito mode on different browsers:

Incognito Browsing with Chrome

1. Open the Chrome browser and press Ctrl + Shift + N to open a new Incognito instance without browser extensions.

Browsing incognito in Chrome.

2. Visit the website to see if the “too many redirects” error is gone.

InPrivate Browsing with Edge

1. Open Microsoft Edge and press Ctrl + Shift + N to open a new InPrivate instance without extensions.

Browsing incognito in Edge.

2. Visit the website to see if the “too many redirects” error is gone.

Private Browsing with Firefox

1. Open Firefox and press Ctrl + Shift + P to start a new Private instance.

Browsing incognito in Firefox.

2. Visit the website to see if the “too many redirects” error is gone.

Private Browsing with Safari

1. Open a Private window in Safari by pressing CMD + Shift + N.

Browsing incognito in Safari.

2. Visit the website to see if the “too many redirects” error is gone.

Clear Website Cache

If you own the site that’s stuck in a redirect loop and the steps above don’t help, try clearing the cache and cookies in WordPress. Access the WordPress admin dashboard and clear the cache using the caching plugins you have installed.

Note: If you cannot access your WP dashboard, use an FTP client such as FileZilla and empty the contents of the wp-content/cache directory to clear the website cache.

Some of the most popular caching plugins that speed up a WordPress site are WP Rocket and W3 Total Cache. Follow the steps below to clear the cache in the two plugins:

WP Rocket

1. Navigate to the WordPress Admin Dashboard.

2. Hover over Settings and click WP Rocket.

Configuring WP Rocket settings in WordPress.

3. Under Quick Actions, find the Remove all cached files section and click CLEAR CACHE.

Clearing WP Rocket cache in WordPress.

W3 Total Cache

1. Navigate to the WordPress Admin Dashboard.

2. Hover over Performance and click Dashboard.

3. Click Empty All Caches to delete the website cache.

Clearing the cache in W3 Total Cache.

Note: If you are using a different caching plugin, try Googling for instructions on deleting cache from that specific plugin.

Clear Server Cache

If the steps above didn’t resolve the “too many redirects” error, perhaps the issue is incorrect or outdated cache on the server-side.

Note: Read our tutorial to learn to flush DNS cache in macOS, Windows, & Linux.

If you can’t access the WordPress Admin Dashboard, the solution is to use the control panel tools of your WordPress host to clear the cache on the website. Clearing the server cache depends on the hosting provider.

Most WordPress hosts offer one-click solutions for clearing the server cache, so contact your hosting provider for further instructions.

Check All Website Versions

The “too many redirects” error can result from improper WordPress site settings. For example, if the home URL and website URL don’t match, the visitors get stuck in a redirect loop. The two fields can get changed when migrating hosts or changing domains.

To fix mismatched URLs, ensure that both URL fields are set correctly. Follow the steps below:

1. Navigate to the WordPress Admin Dashboard.

2. Click the Settings option and locate the fields labeled WordPress Address (URL) and Site Address (URL).

Configuring site settings in WordPress.

3. Make sure that the two fields are identical, set correctly, and not pointing at a wrong domain. This includes both www, http, and https prefixes.

Note: A common mistake is that the URL fields don’t contain the same prefix as the rest of the site. Make sure to use the correct prefix, www or no www. Also, check for any whitespaces at the URL’s beginning or end.

If the redirect loop denies you access to the WordPress Admin Dashboard, use an FTP client (such as FileZilla) to edit the wp-config.php file and define the URL values manually.

Follow the steps below to edit the wp-config.php file:

Warning: Be careful when modifying the wp-config.php file as it contains information WordPress uses to connect to the database. Always make a backup before saving any changes.

1. In FileZilla or a different FTP client, navigate to public_html directory and look for the wp-config.php file.

2. Right-click the file and select Edit.

3. In the file, add the following lines above the /* That's all, stop editing! Happy publishing. */ line:

define('WP_HOME','https://yoursite.com');
define('WP_SITEURL','https://yoursite.com');

For https://yoursite.com, enter your site address.

Editing site settings in wp-config.php.

4. Save the modified file and upload it to the website.

5. Reload the site to check if the problem has been solved.

Check SSL

While acquiring an SSL certificate is a smart move that keeps your site secure, not configuring it properly can cause a redirect loop. Using a redirect mapper tool, determine if the HTTPS settings are causing the redirect error.

The tool is similar to the redirect check tools, but it only shows results for www to non-www redirects and http to https redirects. If there are multiple redirects listed between the http and https versions of the site, it might be the source of the redirect loop.

Change the security protocol back to its default settings and refresh the website. If the error message is still there, try resetting the SSL certificate altogether.

Note: Learn more about how SSL certificates work.

Check Plugins

Search for any plugin conflicts on the website. This issue occurs when the code from two plugins, a plugin and a theme, or a plugin and the WordPress core interfere with each other. Start by disabling all the plugins to see if the error message goes away.

Disable the active plugins via the WordPress Admin Dashboard. Follow the steps below:

1. Log in to the WordPress Admin Dashboard.

2. Click Plugins and select Installed Plugins.

3. Check the Select All box to select all plugins.

Selecting all active plugins in WordPress.

4. Choose Deactivate from the Bulk actions dropdown menu and click Apply.

Deactivating all plugins in WordPress to troubleshoot the ERR_TOO_MANY_REDIRECTS error.

If you can’t access the WordPress Admin Dashboard, use an FTP client to disable them. Disable the plugins by renaming the wp-content/plugin directory (e.g., to plugins backup).

If the plugins aren’t causing the “too many redirects” error, follow the steps above to reactivate them.

Check Server Config Files

If the redirect error persists, the last option is to check if the server configuration files are causing the error.

.htaccess

The .htaccess file has a significant role in controlling page redirects, so an issue with the file can cause problems with site loading. If the .htaccess file contains redirects, it could conflict with a code or database configuration, or addresses could be pointing back to one another.

Warning: Take caution when editing the .htaccess file as its configurations affect the web server’s behavior. The file is usually hidden as a precaution, but you can find it in the public_html directory by checking the FTP client’s Show Hidden Files option. Always make a backup before editing the file. Check out our article on mod_rewrite to learn more.

Follow our tutorial to edit or create a new .htaccess file on WordPress, or set up the .htaccess file on Apache.

If creating a new .htaccess file hasn’t solved the redirection error, restore the backup file and try the last fix.

Nginx Config

If your website uses Nginx, the the nginx.conf file contains any redirects and the directives that define how the site runs.

The general syntax for redirecting http to https in the nginx.conf file is:

server { listen 80; server_name mydomain.com www.mydomain.com; return 301 https://$server_name$request_uri; }

For mydomain.com and www.mydomain.com, enter your site address. The previous server block should define the $server_name variable. Ensure that the redirects are properly set and that they match the rest of the site.

Note: The nginx.conf file can vary depending on the hosting provider. If the settings are different in your configuration file, we recommend reaching out to your host. They can check the file for any misconfigurations that might be causing a redirect loop on the website.

Conclusion

After following the steps outlined in this guide, you should have successfully resolved the ERR_TOO_MANY_REDIRECTS error on your website. Next, read up on 403 Forbidden errors and how to fix them, learn to resolve the “Temporary failure in name resolution” error, or fix the 500 Internal Server Error in WordPress.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !