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.

  • Does this Magento installation use Redis? If yes - try flushing it's cache too. And don't forget to check write permissions for cache holder in local Magento installation.
    – Dmytro
    Commented May 7, 2015 at 13:49
  • As far as I know this installation doesn't use Redis. Also, I've changed all files permission to _www:_www which is the apache user under OS X. Commented May 7, 2015 at 13:51
  • Double check the permission of magentoRoot/var/cache (check your php temp folder /tmp to see if there are any mage- files). Try deleting cached again, clearing/deleting cache should be the last thing you do. Commented May 7, 2015 at 14:06
  • I've done all that. All seems ok. No mage files in /tmp. I've also managed to re-index and restarted my machine and yet I still get redirected. I'm at my wit's end now... Any more suggestions? Commented May 8, 2015 at 7:36
  • Are there session and cache file generated in the var folder? When you rename the local.xml to local.bak does the install process kick off? Commented May 8, 2015 at 20:29

1 Answer 1


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.

  • I have done the above. The problem now is just the redirect. I did manage to re-index and have lowered folder/files permissions (0777 on local dev machine) and yet the problem persists. I'm thinking if its possible to export the whole of magento (orders, settings, products, etc) into a new install? Commented May 20, 2015 at 5:56
  • You site will come up on a fresh version of Magento and your database. Why don't you checkout a new version of Magento and point it at your database and see if you get a redirect Commented May 20, 2015 at 19:46

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.