erreur

What can you do when the error ERR_TOO_MANY_REDIRECTS appears on your site

You want to view your website or enter the administration interface and you encounter this error:

ERR_TOO_MANY_REDIRECTS

No matter where you go on your website, it’s always the same message.

The error ERR_TOO_MANY_REDIRECTS means that there are too many redirects to reach the page you want to visit.

A simple example, is to imagine that you want to go a site that we will call localhost.com
When you join localhost.com, it may redirect you (it does not) to wp-moon.com.
Wp-moon.com itself can redirect you elsewhere…. or to localhost.com.

So you may understand the problem: localhost.com redirects you to wp-moon.com…. which redirects you to localhost.com… which redirects you once again to wp-moon.com…. indefinitely.

To avoid endless redirecting, the browser displays ERR_TOO_MANY_REDIRECTS to warn you.

Why?

This error can be triggered by several factors:

  • a bad configuration of your hosting
  • an error in the logic, in your .htaccess file
  • a wrong data in your WordPress settings
  • a conflict with a plugin or a theme

You need to identify which modification(s) have been made recently on your hosting, on your website files, or in your WordPress settings (or database).

What can be done to solve this problem?

On your hosting, you must check your DNS zone, if it is correct for each entry or ask your host to analyze your zone.

Then, if it’s a problem with the .htaccess file (you can refer to this article), you can generate a new one:

  • renaming the .htaccess file and see if you can access your site again
  • creating a new one by going, in your administration interface, to “Settings”, then “Permalinks”, and save the settings to generate a new .htaccess file.

This kind of problem can occur especially when a redirection is set up when activating SSL, to redirect HTTP traffic to HTTPS.

For WordPress settings, the wp-options table saves your website settings, for your themes, plugins…
Among them, there is the URL of your website, which will interest us.

  • Connect to your database.
  • If needed, you can upload a phpMyAdmin through a (S)FTP client to your site : https://www.phpmyadmin.net/downloads/. Don’t forget to delete it when you don’t need it anymore.
  • Find the wp-options table.
  • Try to identify if this parameter : siteurl, is present and filled with the URL of your site
  • If not, (but the parameter exists; otherwise the problem will require an other investigation of the cause), run the following query:
    INSERT INTO `wp_options` VALUES (1,0,'siteurl','https://mywebsite.com/','yes')
    https://mywebsite.com must be replaced by the URL of your site.

If your website is accessible again, you will have to make a backup of it (especially the database), but you will have to look for the cause that triggered this problem. It may be necessary to perform a thorough analysis of your website in order to identify weaknesses or flaws that could be exploited.

If a plugin on your website has a problem, it is possible to deactivate all of them in order to identify which one is the cause of your problems:

  • To check if a plugin is involved :
    • Connect with an (S)FTP client to your website.
    • Go to the wp-content folder.
    • Find the plugins folder and change its name.
    • If the error is no longer present, it is indeed a plugin that causes it.
  • Once the previous action has been successfully completed, to identify THE plugin involved :
    • Recreate a folder called plugins.
    • Move one by one the subfolders of the folder you renamed to this brand new “plugins” folder until the error occurs again. Now you know the faulty plugin. You can disable it or try to reach the plugin author to work with him on this problem.
  • .Other way to do this: access your database
    • Temporarily, if needed, you can upload a phpmyadmin via (S)FTP: https://www.phpmyadmin.net/downloads/
    • Go to the wp-options table.
    • Identify the option_value field and isolate the lines that contain active_plugins
      • Tip: to highlight these rows, you can run this query:
        SELECT *FROM wp_options WHERE option_name = 'active_plugins';
    • For each plugin, replace in the value a:1:{} with a:0:{}.

To know if it’s a theme which causes this error, we suggest that you test with the default WordPress theme

  • Connect with an (S)FTP client to your site.
  • Go down the tree to the themes folder in wp-content and rename the theme folder you use for your website. WordPress will then load the default theme (you can download it from https://wordpress.org/themes/twentynineteen/ and upload it to your server in the theme folder of wp-content).

A last option, not mentioned here but which can be useful (and sometimes even proposed by the web browser itself), is to delete the cookies from your browser and try again to access your website. You can check the help of your web browser to know how to do this.

Leave a Comment

Your email address will not be published.

You may also like