err_too_many_redirects cakephp


The “err_too_many_redirects” error can occur when a web page is redirected to itself or to another page that is also redirected, resulting in an infinite loop. This can cause the browser to display the “err_too_many_redirects” error message.

In CakePHP, this error can occur if you have a redirection loop in your routing configuration or if you are using the $this->redirect() method in your controller code to redirect to a URL that is itself redirected.

To fix this error, you will need to identify and correct the source of the redirection loop. Here are some steps you can follow to troubleshoot the issue:

  1. Check your routing configuration: Make sure that your routes are correctly configured and do not form a loop. You can use the bin/cake routes command to list all defined routes in your application and check for any problems.

  2. Check your controller code: Make sure that you are not using the $this->redirect() method to redirect to a URL that is itself redirected.

  3. Check for redirects in your middleware: If you are using custom middleware in your application, check to make sure that it is not causing a redirection loop.

By following these steps, you should be able to identify and fix the source of the “err_too_many_redirects” error in your CakePHP application.