I have installed Magento using MAMP for access on a localhost (as to not touch the live site).

I have then imported the database to duplicate the live site and have changed the username/password etc in local.xml.

The problem I have is that every time I try and visit my local site it redirects me to the live site.

I have gone into my /private/etc/hosts through Terminal and have added the line: http://localhost/magento but I still can't get it to work.

Every time I visit http://localhost:8888/magento/index.php it forwards to the live site.

Does anyone have any ideas??

9 Answers 9


Check the table 'core_config_data' and seach for paths 'web/secure/base_url' and 'web/unsecure/base_url'. They should point to your local site.

  • Thank you for your response. I looked for those files and don't have them :/ the closest I have is: web/secure/base_link_url and web/unsecure/base_link_url Apr 23, 2015 at 17:38
  • They could also be set in the local.xml and related.
    – luemic
    Apr 23, 2015 at 17:52
  • Can't see anything in my local.xml file. Perhaps I can just create these files that are missing in the database? Apr 23, 2015 at 17:55
  • That would probably help. However I think it's a ggood idea to scan the xml files/database for your live url. Maybe you should scan your server rewrites (e.g. .htaccess) as well.
    – luemic
    Apr 23, 2015 at 18:00
  • Okay, here's what I done: I put all the Magento core files back (removed all the backed up files) and just changed the database information to be that of the database only. As soon as I changed the database information it redirected back to the live site, so I think i'm right in thinking that the problem lies in the database. The only item in the database that has the live site is for 'cookies'. Apr 23, 2015 at 18:14

There are quite a few things to check for this, most have been covered, but the really tricky ones you won't find in most places.

Most Common

  • A redirect, such as an apache server hidden .htaccess or an nginx configuration file location block.
  • Second most common is that you've done everything correctly, but not cleared the cache. You can just delete the entire 'var' folder at the web root, it will be recreated when you visit the site in your browser.

Notes: Var folder permissions may be 777. Via terminal this is 'chmod -R 777 var' if you are in your web root.

The above instructions are assuming you've already completed the usual actions. Next are those actions, and some oddities.


All stock changes are in the 'core_config_data' table. Under 'path' column check the following and adjust their data in the 'value' column:

  • web/unsecure/base_url
  • web/secure/base_url

Format: protocol://youraddress.whatever/ - with trailing slash

Example: http://abc.dev/

TRICKY: Be sure to pay careful attention to https, vs http. Often you need to change the https to http.

TRICKY: Some Magento installs have multiple stores. Multiple stores will have multiple web secure urls set. Be sure to change them all- this one is easy to miss. Usually I just search the value column for the url, or a piece of it, to find all of them.

Cookie Domain

TRICKY: This one is often not mentioned as its very uncommon, but check the 'path' column for 'web/cookie/cookie_domain'. If this is set to a url, set it to your new url in the same format.

Example: www.site.com becomes www.site.dev


Post answered:

I just needed to update the web/secure/base_link_url and web/unsecure/base_link_url in the database.


Check the table 'core_config_data' and search for paths 'web/secure/base_url' and 'web/unsecure/base_url'. They should point to your local site.

and also clear the cache and try it.


In my case it was config with path=payment/wayforpay_payment/merchant which has old domain with dots replaced by underscores, e.g. www_yourdomain_com. After I changed it to mynewdomain_com issue was resolved.


You just need to change database setting in your PHPMYADMIN.

just find core_config_data table.

and change web/unsecure/base_url value URL. and change web/secure/base_url value URL.

Hope this will work.


I faced this issue and solved it using following steps.

1. Change base_url

Navigate to the core_config_data table in your database and add your store url to the value column of following path column.


2. Clear log entries

Run following SQL query in order to truncate log tables.

TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;

Step 1: Change base_url in core_config_data

Step 2: Remove page Cache. rm -rf var/page_cache/*

Step 3: Change Cookie domain in core_config_data. Check cookie domain SELECT * FROM core_config_data WHERE path ='web/cookie/cookie_domain';


You can try flash redis in case the other solutions don't work

redis-cli flushall

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.