I'm new to Magento, after installation of Magento 2 community edition.I am not able to access the admin panel. I am getting below error.

This web page has a redirect loop

Error ERR_TOO_MANY_REDIRECTS

Please help me to resolve the issue. Advance thanks to all.

  • Give more information. How did you install magento? What are the parameters, that you entered during installation – Arkadii Chyzhov Dec 22 '15 at 14:58
  • Do you have XDebug enabled? – Alex Paliarush Dec 22 '15 at 15:12

17 Answers 17

I had same problem manipulating databases, this answer resolved my problem ERR_TOO_MANY_REDIRECTS :

https://magento.stackexchange.com/a/84756/50635

To correct this, please try to set Use Secure URLs in Admin to true, in System -> Config -> General -> Web.

Or with database access, change following record value to 1 :

SELECT * FROM core_config_data where path like '%web/secure/use_in_adminhtml%';
  • 1
    In my case, it's value is already 1, still I'm seeing this error. – kashish Aug 18 '17 at 7:53
  • works like charm – mrtuvn Mar 30 at 8:54
  • Works, very good – Vu Tran Kien Sep 26 at 8:45

In my case, I was importing an already existing Magento 2 database. The reason I was getting the error was because of the cookie domain in the database. Go to your database and look in the table core_config_data. You should see a path called web/cookie/cookie_domain. Make sure the domain matches the one you installed Magento 2 on. Ex: If you installed Magento 2 on local.dev/<magento-root> the entry in web/cookie/cookie_domain should be local.dev.

  • 1
    I was having the same problem. I changed the value in web/cookie/cookie_domain from NULL to my domain name, but still it's not working. – kashish Aug 18 '17 at 7:51

I refer to your magento store domain as example.com in this post. If its www.example.com or store.example.com or whatever, substitute accordingly.

I just ran into this issue and here are the specifics. Magento 2 2.2.2 install. I had configured the secure base url's to http://example.com/ initially and as I was getting my letsencrypt ssl cert configured on my server, I thoughtlessly enabled the option to redirect all http traffic to https.

This wouldn't be an issue normally, but Magento can be a bit temperamental. I visited my storefront and my SSL is working correctly, but as I attempted to access admin, I received the "ERR_TOO_MANY_REDIRECTS" notice and a failed page load.

I see several ways to fix this issue but the one that worked for me first attempt was this.

  1. SSH into server.
  2. cd to your magento install dir.
  3. run the following command:
    • php bin/magento config:show

view the output and look for web/secure/base_url, web/secure/base_link_url & web/secure/use_in_adminhtml.

These values should be configured with https://example.com/ for the url options and web/secure/use_in_adminhtml = 1.

If they are not, you can run the following commands from your magento install directory to update your configuration.

  1. php bin/magento config:sensitive:set web/secure/base_url https://example.com/
  2. php bin/magento config:sensitive:set web/secure/base_link_url https://example.com
  3. php bin/magento config:set web/secure/use_in_adminhtml 1
  4. php bin/magento cache:clean

After that, visit your admin page, clear your browser cache, reload, and you should now have your access back! with SSL support.

First step I would take after that is to log back into the admin portal and verify your configuration options to ensure you arent going to run into any other unexpected problems.

I hope this help!

Here are some Magento resources to help guide you:

Set Configuration Values

Other Configuration Paths Reference

Sensitive and System Specific References

In my case, I copied website from client's server, and was setting up it on my local system. I simply removed cookie/domain from

core_config_data

table and then flushed cache, it worked for me!

You can also do it:

In the "core_config_data" table remove the value of "web/cookie/cookie_domain" and set "web/cookie/cookie_httponly" to "0". Clear the cache by removing the files in "var/cache".

I got the error ERR_TOO_MANY_REDIRECTS because I forgot to set the PHP version to PHP7.

This error occurs due to using localhost as your hostname, especially in Chrome. We recommend using your own domain. Check Alan's blog for details

It is not Magento, it’s that web browsers behave differently when used with a domain name with less than 2 dots in it, such as localhost.

  • Where did OP mention he installed it using "localhost"? – MrUpsidown Mar 14 at 15:57

You can try reinstalling the Magento with your local IP rather than localhost.

This will be http://127.0.0.1/foldername. After installing this way, you will be able to access it from any browser.

You can also change the record in the database in core_config_data where the value will look like:

http://localhost/foldername/

replace that to

http://127.0.0.1/foldername/

In both ways, foldername is your directory where Magento resides.

I had the same problem after switching the site to https. When I checked the web/cookie/cookie_domain in core_config_data it was NULL.

mysql> select * from core_config_data where path like 'web/cookie%';
+-----------+---------+----------+--------------------------+-------+
| config_id | scope   | scope_id | path                     | value |
+-----------+---------+----------+--------------------------+-------+
|        19 | default |        0 | web/cookie/cookie_domain | NULL  |
+-----------+---------+----------+--------------------------+-------+
1 row in set (0.00 sec)

I then set it to my fqdn:

mysql> update core_config_data set value = 'mysites.fqdn.com' where path = 'web/cookie/cookie_domain' ;

After that I restarted the website and it worked fine:

systemctl restart apache2

Resolving this problem https://github.com/magento/magento2/issues/2473 you need to change the name of the domain name

Also - just to add what I experienced, if you are serving from apache but using nginx to terminate ssl (and probably varnish cache) then make sure your apache has

 SetEnvIf X-Forwarded-Proto "https" HTTPS=on

otherwise it goes around and around with nginx redirect frenzy

Don't use umlauts in base-url e.g.:

www.yourhost/österreich

I had to rename it to

In my case, I have set the value for the web/cookie/cookie_domain path in the core_config_data table to NULL.

You can do that using Magerun, like that:

magerun config:set web/cookie/cookie_domain NULL

I am using Magento 2 on AWS and by following Ryan Wilson's suggestion Fixed the problem by going to the htdocs folder where magento is installed and use the following command

sudo php bin/magento config:set web/unsecure/base_url http://www.yoursite.com/
sudo php bin/magento config:set web/secure/base_url https://www.yoursite.com/
php bin/magento cache:clean

in version magento 2.2 I coulnd't even find web/cookie/cookie_domain path in the core_config_data. so in my case the problem was with memcached service. I have set up session.save_handler = memcached in php.ini according to magento docs and this stopped admin from opening correctly, meanwhile front was ok. After changing handlers back to session.save_handler = files all worked

Please check if in your nginx/apache there is SSL connection configured. Once you ticked SSL connection for admin access and you do not have SSL configured, it redirects to standard http:// connection and then back to https://. That's why there is a loop.

There should be something like this in nginx:

server {
    listen 80;
    listen 443 ssl;
    server_name test.com;
    set $MAGE_ROOT /storage/test.com;
...
  • Where did OP mention nginx? Where did you change that configuration and why? What does it do? – MrUpsidown Mar 14 at 16:10

Try using this .htaccess fix

############################################
SetEnvIf HTTPS On HTTPS=on

In my case I was using IP instead of localhost but still didn't resolve. Changed admin url key. It worked.

Of course all above answers are still valid as we faced and applied those during development.

Chrome causes this a lot. Firefox is bit better in handling this.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.