Aario's blog about life and technology

Web Development

Move a magento server – Why my magento server redirects me to localhost?

In my case I installed a magento on my localhost on /var/www/magento to be accessible trough 127.0.0.1/magento.

After a while I just decided to access my site from another computer on my local network. So this time I entered 192.168.1.4/magento (IP of my first computer with magento installed locally). It quickly redirected me to localhost/magento!

To fix that I entered the database on my first computer and entered:

update core_config_data set value=’http://192.168.1.4/magento/’ where value=’http://localhost/magento/’;

Remember two things:

  1. The new address must end with a slash character ‘/’ or you gonna see an ugly white theme on your site!
  2. If you are moving your magento to a new server with completely different configuration, you need to open your <magento installation path>/app/etc/local.xml file and edit the <connection> tag to modify database connection settings (i.e. username, password).

Hope it helps!

Advertisements