2
votes

I'm making my development backup of the live Magento website, so far I did the following:

  • created mywebsite.local virtual host
  • copied all files from live server to local machine
  • imported dump database
  • changed the etc/local.xml database parameters
  • replaced all rows in core_config_data containing mywebsite.com into mywebsite.local
  • deleted all contents under VAR

The thing is - when I go to mywebsite.local it redirects me to mywebsite.com. This happens in the index.php file, exactly on the Mage::run line. I tried turning off all htaccess rewrite rules, it doesn't help so that's not the problem.

What am I missing?

3
There's a couple core_cache* tables. Have you tried clearing them out as well?jprofitt
There are three core_cache tables, but all three were initially empty, so unfortunately that's not it.Relja
From a quick glance into run() it should only be trying to redirect you if it thinks you have an invalid session or if it thinks it isn't installed. In app/Mage.php take a look at the run() function and maybe comment out the header() calls and put something to print the Exception messages. Might help uncover what's going on.jprofitt
@Relja: did you also change the values of web/cookie/cookie_domain path(s) in table core_config_data accordingly?Jürgen Thelen
I solved this, it was a cache problem. It appears that it's not enough only to empty the VAR folder, and cache tables in database, but you have to flush the Magento cache, and since I didn't have access to the admin part I used the Magento API script. Have no idea where this cache was stored. Thanks everyone!Relja

3 Answers

2
votes

The Magento cache also needs to be flushed, it can be done using the following script

 require_once 'app/Mage.php';
 $app = Mage::app();

  echo "<pre>";
  if($app != null) {
       echo "The app was initialized.\n";
       $cache = $app->getCache();
       if($cache != null) {
               echo "The cache is not empty. Clean it.\n";
               $cache->clean();
        }  
   } 
0
votes

You need to make sure that you changed all the urls in the core_config_data table. the url values can be stored multiple times.

Do a db query like this to make sure you get them all

SELECT * FROM `core_config_data` WHERE `path` LIKE '%base_url%'

Also check you .htaccess file to make sure you are not rewriting requests to the old url

0
votes

go to your local host database and go to core_config_data change base url to your localhost url