1

I’ve got this problem: Magento redirection problem after moving

I changed local xml, deleted cache, changed secure and unsecure link, everything… It doesnt’ work. The only difference is that I duplicated my installation on the same server and I changed subdirectory’s name for the second installation. But I tried also on another server and is almost the same, except for the fact that it keeps linking me back to Google, and not to old domain.

I noticed that if, on the other server, I don’t change subdirectory’s name everything works (and I don’t understand why) but I want on the same server 2 identical installation with 2 identical databases. How can I? What’s the problem? How can I avoid this wrong redirect?

Community
  • 1
  • 1
Deep Black
  • 11
  • 1
  • 2

3 Answers3

1

Magento relies heavily on caching. I've noticed in the past I've had to clear my browser internet cache before the redirects updated.

Also if you cloned/duplicated the code & database, its likely you will have the old URL's in the rewrite module. Have you tried reloading all the indexes after moving and changing the URL's in the magento configuration?

Worst case you may have to change the URL in the core_config_data table in the database.

deepmark
  • 93
  • 2
  • 5
  • 1
    I changed only secure and unsecure url in core_config_data. But how can I reloading all the indexes without enter in site cloned's panel admin? Is there a way? – Deep Black May 02 '12 at 11:04
  • there should be a shell folder in the root folder and a php file in there called indexer.php you can run it with: php -q index.php reindexall – deepmark May 02 '12 at 14:19
1

There is no reindex required for base_url to be taken in account. Only cleaning cache is required. Are you sure you did it well ? What cache system are you using ?

What did you changed in your local.xml for this ? Are you sure you didn't left old information in a local.bak.xml for example ? Magento reads every xml file in /app/etc

JBreton
  • 516
  • 3
  • 10
  • I deleted all the files in var/cache and var/session. Is it correct? I don't know what cache system I'm using, the default system I think. – Deep Black May 02 '12 at 11:37
  • In local.xml I changed username, password and database name for the new database cloned. In app/etc I've got local.xml, local.xml.additional and local.xml.template – Deep Black May 02 '12 at 11:46
  • 2
    If you don't know what cache system you are using, you should use file one, so, yes you must be right deleting var/cache. var/session is useless as it containts customer session data, nothing related to urls. By the way, does Magento populates var/cache after deleting it ? Because sometimes, with wrong file permissions, Magento uses PHP Temp path instead of var/cache... – JBreton May 02 '12 at 11:46
  • Yes, it's strange because Magento populates the directory var/cache of the second site despite I've got no access to the second site, because I'm immediately redirected to the original site. – Deep Black May 02 '12 at 11:58
  • Just if I rename the directory of the cloned site with the name of the directory of the original site I can access to the second site. Magento accepts only that directory's name, the name of the original directory, otherwise I'm redirected. – Deep Black May 02 '12 at 12:03
  • Which page of Magento are you trying to access ? Front ? Back ? Because, Magento doesn't redirect you normally. it only generates links with the base_url... It redirects you only if login-in – JBreton May 02 '12 at 12:10
  • Now it works... I'm really surprised... I did nothing special. Since you told me so I deleted another time Magento's second site cache and after also the browser's cache. I restarted the browser and after I taped MANUALLY, letter by letter, the front address page url (usually I tried to access at first to back page, and after to front). But I'm sure I have done previously, the only difference is that I didn't tape url manually and maybe for the first time I tried to access at first to front page and only subsequently to back. I don't understand. Thanks for your help. – Deep Black May 02 '12 at 12:33
  • Yep, when changing base_url, it's always better to try do display a page that doesn't leads to a redirection, or doing a php -f cron.php – JBreton May 02 '12 at 13:21
  • + 1000 to JBreton, your comment about magento caching to PHP Temp path (in my case /tmp/magento) without complaining at all! (wt*?) just probably saved me hours of painful debugging. – workflow Mar 14 '14 at 12:59
0

I have encountered this when moving, and it ended up being that my .htaccess file still had an old rewrite rule pointing to the old domain. In case someone else has this issue for which the other suggestions to not apply, look for something like this:

RewriteCond %{HTTP_HOST} !^www\.localhost\.com$ [NC]
RewriteRule ^(.*)$ http://www.localhost.com/$1 [R=301,L]

and make sure obviously that the localhost.com matches your domain (the above simply redirects with a 301 permanent redirect rewrite any request that does not begin with www.localhost.com to http://www.localhost.com/ (such as the non-www localhost.com)

Fiasco Labs
  • 6,457
  • 3
  • 32
  • 43
grok_in_full
  • 370
  • 3
  • 18