Unable to login to admin

I had a problem, I developed a site on apache on a windows machine, but I also wanted to develop the site on my Linux (Ubuntu) laptop. After transferring the site across, files and database I just couldn't login. Whatever I did it just went back to the login screen without logging in.

I tried every solution out there, changing the password hash code through the database, changing the password through drush. Absolutely nothing worked. Finally I found the answer and I hope it works for others. But don't be surprised if it doesn't.

Basically in the end the solution was quite simple. I needed to enable clean URLS with the mod rewrite function.

Check if mod_rewrite is enabled

sudo apache2ctl -M

This lists the modules, if mod_rewrite is listed I can probably say this is not going to work for you. If not you may be in luck

sudo a2enmod rewrite

This enables it

Now you just need to restart apache

sudo /etc/init.d/apache2 restart

If you're in luck you will now be able to log in.

Add new comment