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


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
  • After having some issues setting up SSL I got the same problem. Just running this fixed it: sudo php bin/magento cache:flush – AdNauseum May 2 '19 at 22:49
  • Recommended solution !! This worked for me. It saved my time!. ERR_TOO_MANY_REDIRECTS – wewagod Mar 1 at 6:53

28 Answers 28


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


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%';
  • 9
    In my case, it's value is already 1, still I'm seeing this error. – kashish Aug 18 '17 at 7:53
  • 1
    works like charm – mrtuvn Mar 30 '18 at 8:54
  • Works, very good – Magetop E-commerce Sep 26 '18 at 8:45
  • Thank you!! Worked as expected! – MazeStricks Oct 23 '19 at 3:13
  • surprised this got so many likes, the OP clearly stated "they" can't access the admin area so how are they suppose to go into the admin to change anything. – Sebastian Sep 4 '20 at 11:44

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.

  • 7
    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
  • 1
    Thanks a lot! I changed value to my "domain.local" and everything works – Nikolai Silin Jan 11 '19 at 14:46
  • thank you so much!! for me that was the issue! :D – Pierre-Verthume Larivière Dec 10 '19 at 16:13

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

  • 1
    Thanks. Additionaly I had a redirect set up by plesk from http to https that I had to disable in order to get magento backend up. Note: cleaning cache is an important step here. – s.Daniel Mar 6 '19 at 9:56

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


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 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

This worked for me !

php bin/magento config:set web/unsecure/base_url http://example.local/ 
php bin/magento config:set web/secure/base_url https://example.local/ 
php bin/magento config:set web/secure/use_in_adminhtml 1

Make sure that the cookie domain is set to your domain:

php bin/magento config:show web/cookie/cookie_domain

if not, then set it like this:

php bin/magento config:set web/cookie/cookie_domain www.example.com

I once noticed that the field with path web/secure/base_url was missing in the table core_config_data but web/unsecure/base_url existed. So I solved it by changing http in web/unsecure/base_url to https.


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.

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

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

This will be 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:


replace that to

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


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


None of the proposed solutions here worked for my development environment that was running in a Docker container. What worked for me was changing the following line in etc/nginx/fastcgi:

fastcgi_param HTTPS $https if_not_empty;


fastcgi_param HTTPS on;

Source: https://magenticians.com/magento-ssl-configuration-issues-resolved/#Enabling-SSL.

  • (Don’t forget to restart the container after making said changes.) – ACJ Jul 17 '19 at 8:58
  • 1
    Thanks so much! This worked for me. None of the other answers work. – venkatareddy Mar 29 at 9:55

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


I spent 2 days fixing this issue. In my case I was using nginx reverse proxy proxy_pass magento 2.3 site hosted on apache2 virtual host. I tried to set all these configs:

  1. web/seo/use_rewrites -> 1 and 0
  2. web/unsecure/base_url -> http://.. and https://
  3. web/unsecure/base_link_url -> http://../ and https://../
  4. web/secure/base_url -> https://
  5. web/secure/use_in_frontend -> 1
  6. web/secure/use_in_adminhtml -> 1
  7. web/cookie/cookie_domain -> my.publicdomain.com
  8. web/cookie/cookie_httponly -> 1 and 0
  9. web/cookie/cookie_path -> /
  10. web/secure/base_link_url - https://../
  11. web/secure/base_static_url -> https://../
  12. web/secure/base_media_url -> https://../
  13. web/secure/enable_hsts -> 1 and 0
  14. web/secure/enable_upgrade_insecure -> 1 and 0

Playing with these configs using 1 or 0 values from http to https, but this issue didn't fixed even when deleted:

rm -rf pub/static/frontend/* pub/static/adminhtml/* var/cache/ generated/* var/page_cache/ var/view_preprocessed/ var/composer_home

And bin/magento setup:upgrade, bin/magento setup:di:compile, bin/magento setup:static-content:deploy -f

but all this didn't work...


Finally I came across this article: Magento 2 Full SSL with Varnish

And I changed my nginx virtual host config as below:

server {

        server_name magento2.local;

        location / {
                proxy_pass http://magento2.local:8765;
                proxy_set_header Host $http_host;
                proxy_set_header X-Forwarded-Host $http_host; # added this header
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto https; # added this header
                proxy_set_header X-Forwarded-Port 443; # added this header

    listen 443 ssl http2; # here http2 was missing
    ssl_certificate /path_to_certificate.pem;
    ssl_certificate_key /path_to_certificate_key.pem;
    include /path_to/options-ssl-nginx.conf;
    ssl_dhparam /path_to/ssl-dhparams.pem;


and the config looks like this:

  1. web/seo/use_rewrites -> 1
  2. web/unsecure/base_url -> https://my.publicdomain.com/
  3. web/unsecure/base_link_url -> https://my.publicdomain.com/
  4. web/secure/base_url -> https://my.publicdomain.com/
  5. web/secure/use_in_frontend -> 1
  6. web/secure/use_in_adminhtml -> 1
  7. web/cookie/cookie_domain -> null
  8. web/cookie/cookie_httponly -> null
  9. web/cookie/cookie_path -> null
  10. web/secure/base_link_url - https://my.publicdomain.com/
  11. web/secure/base_static_url -> null
  12. web/secure/base_media_url -> null
  13. web/secure/enable_hsts -> 0
  14. web/secure/enable_upgrade_insecure -> 0

Cleared cache, setup upgraded deployed static files, cleared browser cache and boom admin got working again.


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


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

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.


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


i had same problem get it fixed by going in

SELECT * FROM core_config_data where path like 'web/secure/use_in_adminhtml'

the valued is changed by NULL to 1


Manually delete var/cache/* and var/sessions/* did fixed for me after moving the site from one sub domain to another and changing the necessary base_urls.


In my case Windows did not produce the interceptors properly. I compiled the code on my windows OS and copied the code into my docker container. I suggest the problem is a path issue. See here

My Magento Version was 2.3.3


Try below command and it should work,

php bin/magento config:set web/secure/use_in_adminhtml 1

Magento is redirecting to defined urls in the settings and also it tries to redirect to secure url if not allowed in config. In the proposed solutions are all other causes covered.

In our cause it has been a docker container running magento behind Apache proxy and when we configured the Magento to public url we got redirect loop. The fix was to add to configuration

# Redirect all requests to their respective HTTP vhosts
    RewriteEngine On
    RewriteRule ^/(.*) http://docker.example.com:8011/$1 [P]
    ProxyPassReverse / http://docker.example.com:8011/

## This fixed the redirect loop
    ProxyPreserveHost On # otherwise the Magento will receive http://docker.example.com:8011 as current url
    RequestHeader set X-Forwarded-Proto "https"  # this tells the magento this coneection is HTTPS

To summarise.

  • check you have set correct urls. But I am not sure about that 1. You may try 0
php bin/magento config:set web/unsecure/base_url http://example.local/ 
php bin/magento config:set web/secure/base_url https://example.local/ 
php bin/magento config:set web/secure/use_in_adminhtml 1
php bin/magento cache:flush
  • check the proxy settings if you run on the docker behind proxy (above solution)
  • check the cookie domain (it is probably not the cause, if you have more store URLs then it may be issue I think. It is not usually set.)
php bin/magento config:set web/cookie/cookie_domain www.example.com

After any configuration change don't forget to flush cache.

php bin/magento cache:flush

Maybe you set a secure url as http instead of https.

If you are using true on %web/secure/use_in_adminhtml

SELECT * FROM core_config_data where path like '%web/secure/use_in_adminhtml%';
| config_id | scope   | scope_id | path                        | value |
|         6 | default |        0 | web/secure/use_in_adminhtml | 1     |

you'll need to as https your urls into your core_config data.

Double check the

`SELECT * FROM `core_config_data` WHERE `path` LIKE '%web%`;

This works for me.

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

Or another way is, ( Setting up the database )

In the “core_config_data” table remove the value of “web/cookie/cookie_domain” and set “web/cookie/cookie_httponly” to “0”. ( rm -rf var/cache )Clear the cache by removing the files in “var/cache”.


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 '18 at 16:10

Try using this .htaccess fix


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