Magento redirection problem after moving
Asked Answered
D

14

17

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?

Dwain answered 29/7, 2011 at 9:32 Comment(3)
Are you using memcached?Copse
Did you replace your cookie_domain in core_config_data as well?Cussed
thx, clockworkgeek. In my case, it was APC on the same system. ;)Bullnecked
D
22

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

Dwain answered 22/8, 2011 at 7:23 Comment(3)
Try the above suggestion after core_config_data update. I usually just rm -Rf var/* and that worked.Astonied
Removing all of the content of var is not necessary right? So rm -rf var/cache/* should work also? Because you could delete backups/exports etc..Linkoski
rm -rf var/cache/* plus update the web_unsecure_base_url and web_secure_base_url in db TABLE core_config_data solved my problem. In my case I had to do both for my Magento Ver 2.4.3Hunger
K
17

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"
Killerdiller answered 29/7, 2011 at 9:36 Comment(6)
Thanks but that's already done. I suspect however that it is still using the old database even though the local.xml was modified and the cache was removed.Dwain
@user: Did you delete cache folder?Killerdiller
I did, I have found the problem already though. Apparently Magento used the 'temp' directory in the server-root aswell :|Dwain
The same issue, modification of core_config_data is not enough.Expressage
It's using the old cached config, stored in another location. If you make the mistake of attempting to run Magento before you properly set your file/directory permissions AND change your BaseURLs, Magento stores it elsewhere and keeps referencing it until it can gain read/write access to var/cache and var/tmpExaminee
@FiascoLabs mkdir var/cache && chmod -R 766 var solved the problem for me. Thanks :)Fleurdelis
L
4

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

Leela answered 23/7, 2013 at 13:55 Comment(0)
B
3

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.

Biretta answered 24/11, 2013 at 9:56 Comment(0)
S
2

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 :)

Sihun answered 3/11, 2013 at 6:15 Comment(1)
Yes, dont forget to change acess from source database to new database in local.xml!Putsch
E
1

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.

Expressage answered 23/10, 2011 at 5:10 Comment(0)
R
1

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

Rummy answered 21/7, 2015 at 6:20 Comment(0)
M
1

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

Madelon answered 23/1, 2017 at 14:6 Comment(0)
C
0

I also had some problems with url redirection, be sure when you set your new domain in backend to add a / character at the end of the url. All the best!

Curtis answered 23/9, 2014 at 17:56 Comment(0)
M
0

in my case it was baseUrl with one upper-case letter

Mariko answered 16/10, 2015 at 10:23 Comment(0)
P
0

Delete cache from var/cache directory.

after that run this query in core_config_data table in magento. after that you ll not get redirect error.

This process ll work for both Magento 1.9.x and magento 2.x

UPDATE core_config_data SET value="http://example.com/" WHERE path="web/unsecure/base_url"; UPDATE core_config_data SET value="https://example.com/" WHERE path="web/secure/base_u

Pituri answered 12/12, 2016 at 6:48 Comment(0)
L
0

I figured out that perform the move operation using interfaces:

  1. Under admin > configuration > general tab > web, update base url and secure base url.

  2. Move your folder.

  3. Under command line tell magento to clear cache.

php bin/magento cache:clean

Ledezma answered 27/2, 2018 at 23:14 Comment(0)
H
0

I had the same problem. If you can call your site by adding index.php to the URL (e.g. http://www.yoursite.de/index.php) then it is most likely a cache issue.

Open the developer console and disable the cache, or just delete the cache in the browser. Then call the URL. This solved it for me!

Hydrosol answered 18/9, 2018 at 15:15 Comment(0)
P
0

I wanted to add my 2 cents here. After manually deleting the cache files in var/cache, still not working. (The URL settings are already correct).

These got me working:

# In the magento root dir

php bin/magento cache:flush
php bin/magento cache:clear

# Replace php with the php runtime you're currently using

The redirection issue has gone.

Profane answered 19/3 at 2:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.