[Drupal] How to avoid local Drupal installation being redirected to the live site?

| | 1 min read

I had an issue with the Drupal installation on local setup that the login links are redirected to live. I have changed cookies name and base URL for my local environment, I have also emptied all cache tables, but still it redirects to the live site.

The following procedure I did to get the redirection correctly to my local environment

  • Check the .htaccess file.
    There might be some rules to redirect on live site.
  • Check your settings.php file - Is there any path set to your live site.
  • Check If you are using any Drupal redirect module. If yes than disable that module than try.
  • My guess is your using the secure login module.
  • Either:

drush vset securelogin_base_url "http://server1/mysitename/user"


drush dis securelogin

or,Run the following query

UPDATE variable SET value = 's:1:"0";' WHERE name = 'securepages_enable';

pass this query in db and flush all cache..