linux n00b

Migrating Magento to new (sub)domain

Posted in Applications, Howto by downforce on August 12, 2010

UPDATE: Well it turns out this fixes the store, but not the downloader/PEAR updater. More work to figure that one out!

I’ve been trialing Magento on and off for a few years and one day I’ll get my butt into gear to migrate my whole store from Zen Cart (which desperately needs to be patched anyway) to Magento, but I’ve been trying to tie it into a new automated pricing script I’ve been developing (also for a year or so).

I’ve also rationalised my count of subdomains on my domain and moved my old magento development environment from dev.domain.com to store.domain.com. Previously migrating domains has been a major PITA for Magento but today I decided to screw around in the database and found it to be rather painless!

The database is in the same location with same username/password so all I needed to do was to update the base_url and here’s all I did:

So a few steps, confirm that the two config_data fields are where you want them:

select * from mag_core_config_data where path like 'web/%/base_url';

I have the following output:

+-----------+---------+----------+-----------------------+---------------------------------+
| config_id | scope   | scope_id | path                  | value                           |
+-----------+---------+----------+-----------------------+---------------------------------+
|        19 | default |        0 | web/unsecure/base_url | http://dev.domain.com/ |
|        20 | default |        0 | web/secure/base_url   | http://dev.domain.com/ |
+-----------+---------+----------+-----------------------+---------------------------------+

So it was a simple case of updating these values:

update mag_core_config_data set value = 'http://store.domain.com/' where path like 'web/%/base_url';

BUT unfortunately it still wasn’t rendering properly. I discovered that the pages get cached! OH NOES!

Oh well, let’s just purge the cache and start again:

#rm -Rf /path/to/magento/install/var/cache

And good to go! Now to upgrade to the latest version.

Advertisements