Magento – Fix Magento redirect to live site in local machine

domainredirectupgrade

I have followed these steps in order to get my live Magento working on my local machine:

  1. Rsynced all files to my local machine
  2. Cleared all cached on live site
  3. Copied the db into my local mysql
  4. Changed the values in core_config_data under web/unsecure/base_url and web/secure/base_url to the new url (I've created a vhost on my local machine so my website address is www.mymagento.lc)
  5. Deleted all files in var/cache and var/session
  6. Changed the db details in app/etc/local.xml
  7. Deleted all mentions to my old url in .htaccess file (after I made a backup of it)

I've done all that and every time I try to access Magento on my local machine I get redirected to my the live url.

What am I missing?

PS: When I tried to re-index running this command from mysite/shell php indexer.php --reindexall I get an error saying that Mage can't connect to the db using the credentials (which is slightly different than the ones in app/etc/local.xml

My Magento version is 1.4 (hence I'm moving it to my local machine to update it) and I run PHP projects on my local machine using the techniques described above without issues.

Best Answer

Because you have stated that you are getting a db connection error when trying to re-index at the command line it sounds like your local.xml is not correct.

1) You should rename your local.xml to something other than anything dot xml (like local.bak) and let the install process run. This will ensure you have a working database.

2) You should install Magerun which will allow you to diagnose issues from the command line much easier.

3) You can also try to connect to your database from your command line which will ensure that you can actually connect to your database.

4) On your local machine for testing you can decrease permissions to ensure that part of your problem is not permission related.

Related Topic