I changed my base URL from a local IP address to a hostname. Magento loads everything fine but when I attempt to login to the admin section the page refreshes without an error. If I type in the wrong password then the page refreshes and displays invalid credentials message.
Magento – Changed base URL in Magento 1.7 and can’t log in now
base-urlloginmagento-1.7
Related Solutions
In admin panel
goto
system->configuration->general->web->session cookie management
in the options add the following things
Cookie Lifetime: 86400
Cookie Path: /
Cookie Domain: Your Domain
Use HTTP Only: No
Cookie Restriction Mode: No
You don't list what you've tried, so it's hard to rule anything out, but here are a few to try:
- Check what type of session management is configured in
app/etc/local.xml
. If it's files, just delete the contents of the var/session directory. If it's db, then truncate thecore_session
table. If you're using something more complicated like Redis or memcached, make sure it's actually installed and configured correctly, especially seeing as you say you've moved servers. - Incorrect permissions on var/session, meaning the server can't write to the directory and sessions can't be started
- Make sure your browser isn't blocking cookies
- Try in private browsing mode, or a different browser
- Check your cookies. Make sure there are no duplicate adminhtml cookies
- Make sure there is no PHPSESSID cookie - this is an indication that the session is being created too early, using the default PHP session cookie name, rather than Magento's choice of name for admin sessions (adminhtml). This could indicate an extension may trying to start a session too early.
- Have you installed any new extensions? Try setting
disable_local_modules
totrue
inapp/etc/local.xml
. If you can now login, try switch it back tofalse
, disable all your community and local modules and then try enabling them one by one. - Are you hosting the site locally? Set your hostname to something that includes periods (.). Webkit browsers have problems setting cookies to domains without any periods (e.g. http://localhost/).
Make sure you have the correct cookie domain set, especially if you have multiple websites. Use this SQL snippet to check what's configured:
select * from core_config_data WHERE path = 'web/cookie/cookie_domain';
Your cookie domain doesn't match your actual site domain
Mismatch between server time and local computer time, meaning cookies are instantly unset
Someone has hacked the class Mage_Core_Model_Session_Abstract_Varien. Download a copy of the Magento version your website is running from the Magento website and compare the class in there to your class.
Not enough disk space on the server, preventing session files being written
A developer has removed the formkey form element (unlikely), preventing Magento from processing the form. Look in the HTML source code of the login page for a form field called
formkey
Use n98-magerun's sys:check command to find any other issues which may be causing this behaviour
There is a login issue in Google Chrome. Set
Use HTTP only
toNo
in theSession Cookie Management
section of System, Configuration, Web. Don't do this on production servers as it is a security risk. Use this SQL snippet to update it:UPDATE core_config_data SET value = '0' WHERE path = 'web/cookie/cookie_httponly';
Best Answer
It looks like this is the classic cookie error. Remove all the cookies from the previous domain or try to login with another browser/incognito mode. Also remember to change the cookie path in your DB. Check this link to achieve that.