user2344179
user2344179

Reputation: 121

Magento has a redirect loop

My Magento web site home page has a redirect loop error. When I try to open it it goes to my old server url and gives the error:

The webpage resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

When I try to go into admin it takes to me old server admin url without any error.

I down loaded the fresh data base and connected my store to that it works fine but when i connect it my old data base it give same error.

Please advise me.

Upvotes: 8

Views: 33968

Answers (7)

DBR
DBR

Reputation: 165

I had the same issue and after reloading and reloading my page I noticed that the error message responded to www.mydomain.tld and sometimes to mydomain.tld. I'm using Plesk on the server and I remembered that I set the Domain to always be called without www. I just changed that to none in the hosting settings of the domain. Lucky me, that solved that issue. Hope that helps someone else.

Upvotes: 0

ManiMaran A
ManiMaran A

Reputation: 359

Issue: ERR_TOO_MANY_REDIRECTS - redirected you too many times

This issue is related cookie domain name.

For ex: if you already installed Magento 2 in www.example.com, and now you change magento base path to sub domain path like www.subdomain.example.com means, then you need to update your cookie domain entry inside of core_config_data table. You cannot access magento 2 backend so you can use following query to check record exist else use insert query.

SELECT * FROM  `core_config_data` WHERE  `path` REGEXP  'cookie_domain'

if record exit then update subdomain.example.com to the value column.

else

INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`) VALUES ('default', 0, 'web/cookie/cookie_domain', 'subdomain.example.com');

Then flush cache using command php bin/magento cache:flush

Refresh magento 2 admin, now you can access admin. try this. thanks.

Note: if you are not using cookie domain, then don't configure this settings, if you configuration wrong then also you can face this error, so to fix that error update value to default configuration.

Upvotes: 0

Sabe Barker
Sabe Barker

Reputation: 351

This isn't an ideal solution, but I was having issues with Magento 1.9.x.

The setup was: Nginx Proxy & SSL Terminator => Apache Webserver

No matter what I did enabling SSL caused a redirection loop. I narrowed the issue down to Magento rather than the Nginx configurations.

It was like Magento didn't know it was receiving a secure connection from Nginx even though the correct headers were set.

The dirty solution was to add some code to the very bottom of index.php within the magento root directory (ie. /var/www/magento) just before the Mage::run... line, like so:

if( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) ) {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = 443;
}

Mage::run($mageRunCode, $mageRunType);

Upvotes: 17

NotJay
NotJay

Reputation: 4076

Wrong permissions can also cause this to happen. So in addition to truncating the var/cache and var/session folders, go ahead and make sure that you have the proper permissions on the app, skin, and includes directories, sub-directories and files. I believe the suggested permission setting is 644. You can do this with a proper FTP client such as FireZilla.

Upvotes: 5

Marcelo Mason
Marcelo Mason

Reputation: 7060

My issue was Cloudflare, put it in Development mode and it worked. It was cache related.

Upvotes: 0

user2344179
user2344179

Reputation: 121

I got it fixed.

I manually deleted my cache i was unable to login in my amdin and it get fixed

Upvotes: 1

Ricky Sharma
Ricky Sharma

Reputation: 1919

Go to table core_config_data

Update these value to be your localhost url(or whatever url you are providing while installation):

web/secure/base_url //(new url)

web/unsecure/base_url // (new url)

Empty the var folder.

Upvotes: 3

Related Questions