Ask me k'no'w querries, I will tell you no lies

How to fix login for Magento admin on local install

July 31, 2012

Problem as described: I enter my correct username and password but I am redirected to the same login page. If wrong credentials are entered an error message is shown that says I entered the wrong username and password. When I enter my correct username and password I get redirected to the same login page.

I use Ubuntu 12.04 as an OS

I worked on Magento so many times since my first dabbling with it for Compub. Installed it on my local system various times to dable with its themeing and coding. Each time i had to use fake domain as virtual host to install magento so that it works fine without the above mentioned error but i had to do this for every time i work on new magento test project. Now i found a new way, with lot of help from googling, to simpify the solution.

Changing Your Hostname(computer name)

To change your hostname(computer name) in Ubuntu 12.04, press Ctrl – Alt – T on your keyboard to open Terminal. When it opens, run the commands below to open the hostname file. sudo gedit /etc/hostname

Then change whatever in the file to what you want your computer new name(new hostname) to be and save it.

Here you have to change the hostname(computer name) to something like fakedomain.extension(

Modify Your Hosts file

Next, open the hosts file by running the commands below. sudo gedit /etc/hosts

Change the second line to match your computer new name(new hostname) and save.

Now restart the system to see the changes.

Now in browser type your new hostname i.e fakedomain.extension and enter you will see your localhost page. Now if you install magento in your local system it works fine as its url is something like fakedomain.extension/magento which doesn’t give any of the problems that i have mentioned in earlier part of this article.

For complete understanding of the Magento admin login problem and resolving it please read this article - by - Aschroder