Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento redirection problem after moving

I've moved my Magento to another server with another domain name, now it keeps linking me back to the old domain. All files and the entire database has been searched&replaced to ensure references are gone. Cache got removed. I suspect it still tries to use the old database so i modified the local.xml file containing the DB info but that doesn't change anything. Since there is no cache does anyone have any idea what goas wrong?

like image 728
user746379 Avatar asked Jul 29 '11 09:07

user746379


7 Answers

Apparently Magento used the 'temp' directory in the server-root for caching as well. cleaning this would solve the issue. This is of course also taken care of when rebooting the server.

Make sure your webserver has write access to the var, var/cache and var/tmp folder in your magento installation. Try using chmod -R 700 var or chmod -R 766 (use the latter with caution).

NOTE: This is the result of not having your file/directory permissions properly set. Magento tries to use var/cache and var/tmp, finds them unwritable by the web server user and proceeds to move its cache to the system /tmp folder. No matter how much you curse and change the BaseURL settings and erase anything you find in var/cache, Magento continues to read the cached configuration out of the system /tmp folder.

Don't believe that Linux Server Admin 101 problems cause this? Here's visual proof.

enter image description here

enter image description here

like image 173
user746379 Avatar answered Nov 20 '22 12:11

user746379


This is probably due to the old base url stored in the database table core_config_data. You have to update that values to point to the new domain.

You can update with the following update queries

UPDATE core_config_data SET value="http://www.newdomain.com/" 
WHERE path="web/unsecure/base_url"

to update secure base url

 UPDATE core_config_data SET value="https://www.newdomain.com/" 
 WHERE path="web/secure/base_url"
like image 29
Shakti Singh Avatar answered Nov 20 '22 10:11

Shakti Singh


here is your answer:

First step was simple – finding in the database base url value: table name is core_config_data and the keys are /web/unsecure/base_url and web/secure/base_url. Change those two to the proper values.

Second step is also very logical – cleanup cache! Magento does cache everything, including values of config table, so go to the Magento root with FTP or SSH, remove everything from the folders var/cache/ and var/session/ and var/tmp. (You can even rename them and create a empty folder in those names).

Hope it helps

like image 42
Fury Avatar answered Nov 20 '22 12:11

Fury


I just had this problem, after trying everything listed above and on several other SO answers i discovered there is more than one base_url definition in the core_config_data table

if you run

select * from core_config_data where path like '%base_url%'

You should see all of the definitions the scope was different on this definition and was overriding the default which i had already changed.

like image 25
user74847 Avatar answered Nov 20 '22 10:11

user74847


one thing more which people easily forget in such cases. local.xml should also be modified according to the settings of backup database. Otherwise you can edit the base_url and clear the cache thousand times and you will never be directed to the url you desire :)

like image 2
Naveed Avatar answered Nov 20 '22 10:11

Naveed


In my case it was even more strange, on my development instance I had no "temp" folder, the cache was stored somewhere outside of site vhost, or in dB, but not in core_config_data. Only flush cache in Magento BE could help, so better to do it before dB dump.

Best regards.

like image 1
Fedir RYKHTIK Avatar answered Nov 20 '22 11:11

Fedir RYKHTIK


in my case it's because I forgot to change the db name in app/etc/local.xml

like image 1
Thịnh Phạm Avatar answered Nov 20 '22 10:11

Thịnh Phạm