I copied a live site built by a previous developer to my local MAMP environment, and discovered that trying to use /user/login redirected me to the live site. I discovered that .htaccess had numerous dreaded 301 redirects. So, I changed the .htaccess to a clean one, cleared cache, cleared history, rebooted MAMP, tried a clean browser. I think I've now cleared the 301 redirects to regular pages, but user/login still goes to the live site.

Created fresh local install with a clean .htaccess; clear cache, reboot MAMP, etc, still can't login to local.

Is there a backend way to login to drupal? Through drush?

Could that demon-spawn developer have set something else that prevents local login?

  • 3
    Is it using the secure pages module, is the base URL set in settings.php?
    – jsheffers
    Commented Dec 17, 2013 at 14:50
  • Yes, Thank you. The secure pages module: drush dis securepages Commented Dec 18, 2013 at 3:01

4 Answers 4


If the live site uses HTTPS, implements SSL, try to check if is using modules like secure_pages. This kind of modules sometimes causes that kind of redirections.

Another thing to check could be the settings.php to see if there are something related to this issue.

  • Thank you Gerzensti & Jsheffers. It was in fact the Secure Pages module. Disabled that with Drush, and I was golden. I was looking in this direction already from a suggestion on another problem to look at Securelogin module. Commented Dec 18, 2013 at 2:58

If you're using Domain or something like this, what I did (on Windows) was editing the "hosts" file to redirect the production site URL (http://www.production.com) to

So all your requests to your production site will be redirected to localhost.

After that, edit your domain settings to set the domain to (or the URL you access your development website).

Finally, delete the redirection in hosts file.

I would also suggest to check for custom modules and clear cache with drush.


Another module that can cause this problem is Ubercart SSL. I was being redirected when attempting to login and it took me a while to figure out which module was the culprit. drush dis uc_ssl did the trick.


If Secure page causing the issue then you can disable it with following ways

1) Drush command

drush dis -y securepages

2) Disable the status in DB

UPDATE system SET STATUS =0 WHERE name = 'securepages'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.