Magento – Form Key Problems After Changing Domains 1.9.2.1

form-keymagento-1.9session

After changing domains, from dev.mysite.com to mysite.com I can no longer login to the backend, I am getting below error:

Invalid Form Key. Please refresh the page.

Also, Customers cannot sign in and products cannot be added to bags.

These are all issues with the form_key, but I have no idea where to even start looking for answers, the system.log only shows:

Warning: strlen() expects parameter 1 to be string, array given in app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php on line 93

This Post suggested to double check cookie_domain, and to increase max_input_vars in php.ini but neither of these had any affect. I have also tried using a fresh .htaccess file

Additional info: I have two sites on this Magento installation (everything worked fine before domain change) and the domains simply changed like so:

dev.site1.com -> site1.com

dev.site2.com -> site2.com

And yes I refreshed cache and session data and restarted apache and mysql after every single change.

Best Answer

The method that solved my problem included two main things:

I had to fix my cookie domain

http://site1.com -> .site1.com

http://site2.com -> .site2.com

Step #2 was the weirdest

I had to go to my old login panel:

http://dev.site1.com

(yes the dns for the subdomain still pointed to the same ip)

and then I was able to login just fine and it actually redirected me correctly to

http://site1.com/index.php/admin/

I will continue to look into why I needed to do this

Related Topic