Magento 2 too many redirects how to fix ?

Fix Magento 2 too many redirects

Rate this article

Share this article

Too many redirections errors are a result of improper use of the redirecting tools. Depending on the cause this error could be from a plugin fault involving your website. Deactivate and delete all plugin folders and test your site for error. Try logging into your site now. It’ll create a new .htaccess file with FTP and deactivate it from your account. Can you fix the redirect problem? Absolutely, yes. To learn how you can redirect loops check our guide.

Fix Magento 2 too many redirects

Find the root cause of the redirect error

Knowing the root cause of the redirect error will help you fix the error quickly and effortlessly. Every time a server returns information to the browsers, it gives a status code so that browser can easily identify the result of the interaction with the server, There is a set of standard HTTP Status CODE that is used in practice you can easily find the redirection problem looking at the status code. Here is a list of HTTP Status code

HTTP Status Code

  • 1xx informational response – the request was received, continuing process
  • 2xx successful – the request was successfully received, understood, and accepted
  • 3xx redirection – further action needs to be taken in order to complete the request
  • 4xx client error – the request contains bad syntax or cannot be fulfilled
  • 5xx server error – the server failed to fulfill an apparently valid request


Using Live HTTP Headers browser plugin 

Install Live HTTP Headers plugin from chrome web store if you are using Chrome.

Install HTTP Header Live for Mozilla Firefox from Mozilla Addon website

Click on the extension after you installed it. It will create a browser tab and open up your magneto URL, Now if you go back to your Live Reload tab you can see the URLs that are being redirected along with the HTTP status code.

This will give you a sense of whats URLs are getting opened first and what follows next.

Live HTTP Headers chrome extension


Using CURL on the command line or terminal

make sure you have curl installed on your computer,

For macOS / Unix / Linux, On your terminal/command line you can try this

curl --version
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

Try the following command replacing the example URL with the actual redirection URL

curl -LI
 or curl --head --location -L or --location option follow the redirection 
-I or --head option makes a head request ( gets only the header info and not the full content, very useful for debugging )

At times the network proxies or the server could cache the request, hence you might get old content to overcome this 

you can use an age-old strategy of adding unique query string at the end of the URL as below


I tried something with I got something like this,  If you also get something similar then you are sure that redirection happens only on the browser, which indicates that it’s happening only in the browser, and you can conclude that it’s because of the browser cache.

curl -LI
HTTP/2 301
content-type: text/html; charset=UTF-8
date: Mon, 18 Oct 2021 09:35:17 GMT
expires: Wed, 17 Nov 2021 09:35:17 GMT
cache-control: public, max-age=2592000
server: gws
content-length: 220
x-xss-protection: 0
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"

HTTP/2 200
content-type: text/html; charset=ISO-8859-1
p3p: CP="This is not a P3P policy! See for more info."
date: Mon, 18 Oct 2021 09:35:18 GMT
server: gws
x-xss-protection: 0
x-frame-options: SAMEORIGIN
expires: Mon, 18 Oct 2021 09:35:18 GMT
cache-control: private
set-cookie: 1P_JAR=2021-10-18-09; expires=Wed, 17-Nov-2021 09:35:18 GMT; path=/;; Secure
set-cookie: NID=511=VhFlJBcje2ORS_swBA35XZFXZ6IULM4GBdHQr3F2fLp9owgnI_56Fezbf-LazYg5QjSZ8lpGp8JqV_gn4Y6XLeTZ5vA6QSCtmCU7m8pVY4quOsgCuiw5nuVHyqQscAaqo576kbHj7LZ9JoTTBVdQw8zTNoqU1hvkORIJw5lvcew; expires=Tue, 19-Apr-2022 09:35:18 GMT; path=/;; HttpOnly
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"

Add a search to your Magento store

The golden rule of debugging website 

Every time or anytime you want to check this redirection problem, you should always check the UN Cached version of your website code. CURL does not cache between successive requests. You should always use CURL and do the check. In this case, you can use

curl -LI

CURL by itself has plenty of options for website/web application debugging, it’s worth exploring giving it yourself some good amount of time. 

How do I fix a redirect error on my web browser?

On average, any browser can handle 20 redirects on time. The root cause is most likely just something you had with the redirection plugin that you might be using. Deactivate the plugin and test your website to detect any potential error. If you have two URL Identifiers in the Address and Site Address Settings then change them separately. You can do one of the following:

  1. Reinstall every single plugin or package you have by enabling the correct ones one by one.
  2. Reinstall the redirect plugin that you have used.
  3. Deactivate all the plugins and enable them one by one and check the site redirection problem after every time you enable a plugin.

How do I fix too many redirects in Magento 2?

You don’t have to be the site administrator. Clear the browser cache/cookies, and then refresh the page. If this doesn’t work, contact the manager to have it fixed.

If you are the site administrator, however, you may need to do some things. As we mentioned, the error is often caused by Magento 2 misconfiguration. Sometimes it is as simple as clearing cache or cookies.

We are going to show you some of these strategies to get rid of this message You won’t let your visitors down.

Make sure to check the URL settings in your magneto dashboard

You should always check your URL settings as a mistake can lead to redirect loops.

  1. Log in to your dashboard. From the main menu, select Stores > Configuration.

Magento Store configuration

2. On the upper right, click System > Configuration.

Magento system configuration

3. From the main menu, under the General list, click Web.

4. Open the Unsecure and Secure drop-down lists, locate the base URL line, and replace this with the new URL.

These addresses should match in most cases. It is important to check it carefully so that any differences are not a problem.

Make sure they do not contain:

  • Whitespaces at the end.
  • www at the beginning (as It should instead be

You can change URLs that contain “www” but not the one you have. They will be identical, or they could both contain it. You can also try to insert PHP before HTML.

Add a search to your Magento store

Refine / Review the .htaccess

.htaccess is the apache web server’s configuration file. Its always good to look at it for any potential problem.

Make sure you take the backup of .htaccess before you do any modification.

Chances are there could be multiple .htaccess files in your folder hierarchy, check / review all the files for potential problems.

Modify the security protocol

Switch to a default protocol if you are using a security protocol (SSL Certificate). Refresh the page to verify that the redirect loop has been removed.

If you still get the message, your SSL certificate must be properly set up before you can use it again. The address remains as HTTPS.

Don’t forget to consult expert support to return to a setting that guarantees access security for users. This is essential to ensure the greater reliability of your site.

What does Magento 2 Error ERR_TOO_MANY_REDIRECTIONS mean?

When the browser cannot establish a link between the original page and the destination page, too many redirects will be displayed.

Google Chrome will display a warning that says “This page isn’t working.” has redirected you too often. Clear your cookies. ERR_TOO_MANY_REDIRECTS” or “This webpage has a redirect loop ERR_TOO_MANY_REDIRECTS.”

On Mozilla Firefox, You will receive:

“The page isn’t redirecting correctly. Firefox detected that the web server redirects the request to this address in a manner that will never finish. This problem can sometimes be caused by disabling or refusing to accept cookies ERR_TOO_MANY_REDIRECTS.”

Both of them are clear in their message: The page won’t load due to it being redirected to a loop or too many redirect requests.

Why does ERR_TOO_MANY_REDIRECTS error occur?

Redirects are either an efficient SEO strategy or a tool to allow users to access pages with a different URL.

Let’s imagine that you have an important website and that your visitors prefer to be directed to a new page.

Use redirects to allow users to navigate automatically to the new page, even though they were trying unsuccessfully to reach the old one. Even though they’ve typed the wrong address once, they can get to the right page.

But, if the configuration is wrong, the browser could get confused and redirect the visitor elsewhere.

When The browser does not understand or know which URL is to be used. The system stops searching for the right URL in order to avoid overload. The error message appears on the screen.

In certain instances, the browser might even enter an indefinite redirection loop. That’s how it works. The old URL redirects directly to the new URL. However, due to misconfigurations, the new URL redirects back to the old URL.

Finally, the system gives up and displays the message: “ERR_TOO_MANY_REDIRECTS”.

Read Magento 2 Search settings guide for more information.

What’s for you?

If you are experiencing errors like TOO MANY REDIRECTS on your Magento store, then the issue is because of your .htaccess file or your cache folder.

Place a new copy of .htaccess from a fresh Magento package and delete the cache and session folder. Then refresh, and it should be good.

Or another way is,

In the “core_config_data” table, remove the value of “web/cookie/cookie_domain” and set “web/cookie/cookie_httponly” to “0”. Next, clear the cache by removing the files in “var/cache”.

Now a question that might arise is how to add a google-like search engine to your Magento store with amazing features. Features like Magento search autocomplete make any site search looks cool and very functional. One such great search solution that transforms your search solution to the like of Google search is Expertrec search. For this, you need to get a Magento custom search module expertrec.

Often you might face the issue of Magento search not working in the current setup. That’s cause Magento is a complicated setup by itself and building on top of itself can lead to a lot of problems. If you try and build a search by yourself often you will come across this problem of Magento 2 search not working how to fix. It could also lead to problems like Magento search not returning results. That is why you need a fast and cool Magento 2 custom search engine.  

Once you have a good search you might think having a voice search completes the mission of giving a Google like experience. You might think it involves a lot of coding from your end to get this set up but no you might also think how to add voice search to Magento 1 and 2 no coding? and that is where Expertrec search comes to the rescue again. Having a Magento 2 custom search bar is easy now and having cool features for your website visitors like Magento 2 custom catalog search is something that can be done very easily without any coding.

Add a search to your Magento store


1. How to properly implement Magento 301 redirects?

Magento 301 helps to redirect visitors from a URL that no longer exists to the one that does. This helps to benefit your Magento website’s SEO. Let’s say you are reorganizing or replacing a complete website. It’s impractical to use the same URL. You can use 301 redirects which still land the user in the exact place. 301 redirects are best when you permanently route incoming traffic to a new URL. The first one is Google and all the modern search engines. 

For example, if a user is searching for your website and you have recently replaced your old URL with a new one or if you change the URL but don’t set up a redirect 301, the user who clicks that URL is going to see an error. Instead, if you set up a redirect 301 when a user clicks the same old URL, your server will automatically recognize the attempt and route the user to the new URL you specified. It helps Google understand that the page’s URL has changed. It’s excellent for maintaining the ranking power as the old one before.

2. How to avoid URL redirects to load your site faster?

Magento2 301 and 302 help to build new URL redirects, which help user land to a new location. 

URL redirects help to connect between an old or broken URL and a new or active URL. When a person tries to open an old link, “redirect” automatically leads them to the new link. URL redirects are not always avoidable, so here are some tips to minimize them – 

  • Do not link to any pages that you know already have an existing redirect on them. It will only lead to multiple redirects and slow down your site.
  • Practice scanning your website regularly to detect old redirects that lead to pages you deleted long ago.
  • Avoid plugins which can result in you unnecessary redirects. So, clear out any plugins that you don’t need.

        3. How to create and use Magento2 redirect 301 & 302?

    Sometimes you want to change or reorganize page URLs or disable them to avoid errors. For this, you need to set up Magento2 301 or 302 redirects. 

    By taking the following steps, you can set up 301 redirects in Magento2 –

    1. Go to Admin panel > marketing > SEO & search > URL rewrites. 
    2. After that, press Add URL Rewrite button.
    3. Then, enter URL Rewrite information.
    • Store – select Store View. This will enable the redirect.
    • Request path – enter the URL for redirection.
    • Target path – enter the URL to which the page will be redirected.
    • Redirect Type – choose the redirect type you need between 301 and 302.
    • Description – enter an optional description.

    After inputting all the details, enter the Save button.

    301 redirects are used to route incoming traffic to a new URL permanently. 

    • To move the Website or Webpage. 
    • To permanently change Domain Name.
    • To change from HTTP to HTTPS etc.

    And, 302 redirects are generally for temporary relocation of a resource.

    • When a page is updating or under maintenance.
    • To lead the user to a related webpage.

    Add a search to your Magento store 

    Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
    You may also like