Monday, March 3, 2014

Magento Admin not working in localhost

When logging into magento admin panel it tries to validate the url whether it is a valid domain or not and if it is not a valid domain, it will erase cookies and come back to admin login page again. Obviously our url will be http://localhost/magento and it is not a valid domain. To overcome this we need to change certain code in a file called varien.php which is located in magento core folder.

Here are the Steps to solve Above Problem:

  • First go to your magento root folder.
  • After that go to app -> code -->core --> Mage --> Core --> Model --> Session-->Abstract --> Varien.php
  • Do not edit core files directly.Later you'll face problem while upgrading to new version if you edit this.
  • instead copy varien.php file. Make local folder inside  app --> code folder.
  • make similar folders like step-2 inside  local folder. for example: app --> code--> local --> Mage --> Core --> Model --> Session-->Abstract --> Varien.php
  • Open varien.php file in an editor. go to line 104.comment the code as shown in below screenshot:


  • That’s it. Now you will be able to login Magento admin panel.

No comments: