Magento – Magento 1.6: This webpage has a redirect loop

magento-1.6

I have a dev site on magento 1.6 . Now I am trying to create a local installation with this dev site files and DB.

I have changed the

  1. web/unsecure/base_url
  2. web/secure/base_url
  3. and web/url/redirect_to_base to 0.

I have also cleared

  1. var/cache
  2. and var/session.

But I am still getting:

This webpage has a redirect loop issue.

Tell me please how to resolve this error?

Best Answer

Magento sets session and session id into cookies in

Mage_Core_Model_Session_Abstract_Varien::start()

Here you can find the call of php function session_set_cookie_params.

This function sets headers for browser to create cookies with params: lifetime, path, domain, secure, httponly. It is very important always to send the same last four path, domain, secure, httponly parameters because otherwise you will not be able to manage(edit, delete) them.

You can set them in System -> Configuration -> Web -> Session Cookie Management.

On every load Magento validates cookies based on System -> Configuration -> Web -> Session Validation Settings. Probably you have Validate HTTP_USER_AGENT set to yes. It means that if user agent will change(this happens all the time when google chrome get new updates), Magento tries to expire(delete) cookies and then redirect customer to the same page.

Now imagine that browser does not allow to delete cookies(because one of the parametes path, domain, secure, httponly is different). Then you will come to the website with the invalid cookie and Magento again redirects you.

To solve the problem you need to set all Session Validation Settings to No or revert Session Validation Settings to default.

Also make sure that you do not have changes in Mage_Core_Model_Session_Abstract_Varien::start().

Related Topic