Can someone help me out? I installed drupal 6 on my wamp server and copy the sites folder of my live site and imported the db to my local site. Now, when I go visit my local site I am being redirected to my live site. I already cleared all cache, truncated the tables on the db that has cache name on it, Nothing unusual on the settings.php also. Why am I being redirected to the live site? Can someone help me out? Thanks!

Comments

imranweb’s picture

Check the .htaccess file.
There might be some rules to redirect on live site.

-Imran

jaypan’s picture

You can also do a search of your entire database for the live site URL, and see if it's in the DB somewhere.

Contact me to contract me for D7 -> D10/11 migrations.

jtfunky’s picture

Already did the search but couldn't find any.

jaypan’s picture

Is your site multi-lingual? Do you have language domains set?

Contact me to contract me for D7 -> D10/11 migrations.

joe huggans’s picture

Hi Jaypan, could you tell me why it is significant if you have a multiligual site as I am getting this problem.

jaypan’s picture

If you set a language as a domain, your system will redirect to that domain when you are in that language. You need to change the langauge domains to local domains on your local system.

Contact me to contract me for D7 -> D10/11 migrations.

jtfunky’s picture

Its a fresh install, so i did not change anything on the .htaccess file. All i did was copy the sites folder from the live site, overwrite my local sites folder, then imported the DB.

tryitonce’s picture

Check your settings.php file - is there a path set to your live site?

jtfunky’s picture

Did that already, no such path is declared there just the db connection.

hemant_gautam’s picture

I am not really sure what is the issue. but i can tell you few ways. May be you can find out the solution.
1. Search the live site url in your complete sites folder.
2. Check If you are using any Drupal redirect module. If yes than disable that module than try.
3. Disable contributed and custom (if you have) modules one by one and try to figure out from where this problem is coming or you can do the reverse also.
Install fresh new instance of Drupal and enabble modules one by one and keep checking weather the same issue is coming or not.
4. Uninstall and install the wamp server again in your local machine.

Thanks

hemant_gautam’s picture

And one more thing is that don't forget to check your host file.

galafik’s picture

I keep having this issue myself and I forget the solution every time. Make sure that you don't have the securepages module enabled if it's on the site.

amjad1233’s picture

If you don't keep your settings.php in repo... (Which you never should)

Just add following lines to your settings.php and it should stop redirection.

 

$conf['securepages_enable'] = 0;
jaypan’s picture

If you don't keep your settings.php in repo... (Which you never should)

Not related to the original topic, but I wanted to comment that there is a very good use case for having settings.php as part of your repository, and in fact I've done this on many systems.

Some settings are made in settings.php, and need to be the same across all environments. For example, connection info to remote APIs. Another example is the Drupal Composer Template, which includes the private files folder above the webroot, with the location coded into settings.php. As the private files directory is part of the repository (though not the contents), it will be in the same location across all environments, therefore having it coded into settings.php makes sense.

The point about not putting settings.php into the repo is that you do not want to commit environment specific settings to the repo. This can be done by doing the following:

1) Uncomment the following lines from settings.php:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
  include $app_root . '/' . $site_path . '/settings.local.php';
}

2) Create the file sites/default/settings.local.php

3) Add any environment-specific settings to settings.local.php, for example the database connection info.

4) Remove settings.php from /.gitignore

5) Add settings.local.php to /.gitignore

6) Commit /sites/default/settings.php to your repository.

Contact me to contract me for D7 -> D10/11 migrations.