Home    Articles

 

Magento redirects to old url after moving to new domain [SOLVED]

 

Recently I have moved a magento store from one domain to another.
After moving the store, I was redirected to the old store(old domain)…every single time.

If you have the same problem and you have done all these steps:

1.Update the “value” to the new store from core_config_data table where the “path” is ‘web/unsecure/base_url’.
2.Update the “value” to the new store from core_config_data table where the “path” is ‘web/secure/base_url’.
3.Update the “value” to the new store from core_config_data table where the “path” is ‘admin/url/custom’.

Or all steps from here …

And YOU ARE STILL REDIRECTED TO OLD DOMAIN

This is a cache problem. I know you cleared your cache before moving….

Before clearing the cache from code, please check the file: app/etc/local.xml to check if you are connected to new database. You are probably using the same hosting and you forgot to change the settings for the new database.

If you have done it and no success….

Do this:
1).Create a new php file in root of your new store.
2).Call it “clear_cache.php” and add this code into it.

<?php 
require_once 'app/Mage.php';
$app = Mage::app();
 
echo "<pre-->";
if($app != null) {
        echo "The app was initialized.\n";
        $cache = $app-&gt;getCache();
        if($cache != null) {
                echo "The cache is not empty. Clean it.\n";
                $cache-&gt;clean();
        }
}
exit;
?>

3).Go to your new store and type this into your browser. ex: www.your-new-domain-here.com/clear_cache.php

Now your store shold NOT REDIRECT ANYMORE.

ps: this will clear your cache from code.

That’s all.

by