Changing Magento Domains

Unlike some web software, changing the domain on Magento's community edition is pretty easy once you have done it once. You need to have ftp or ssh access to the site as well as a tool to manually update the database. I use phpMiniAdmin for quick jobs like this.

First, make sure your Magento installation has write privileges to (magento base)/var. The cache is stored in (magento base)/var/cache.

First, you want the edit the database. Find the `core_config_data` table in your database using your favorite db editing tool.

There are a few records you need to update here. If this is a multi-website installation there will be one of each for each website.

First, look for records with the values web/unsecure/base_url and web/secure/base_url in the path column. These records will contain some variation of the old base url in the value column. I run a command similar to update them: UPDATE `core_config_data` SET `value`='http://newdomain.com/' WHERE `path` IN ('web/secure/base_url','web/unsecure/base_url');. You can update them to the https version later in the Magento web admin panel. As as a note, you can update these before you move the domain in the Stystem -> Configuration -> Web area of the admin, but once you change them here, the site become unusable.

Second, look for records with the values web/cookie/cookie_domain in the path column. These records will also contain some variation of the old base url in the value column, but without the protocol (http, https). I run a command similar to update them: UPDATE `core_config_data` SET `value`='newdomain.com' WHERE `path` IN ('web/cookie/cookie_domain');.

Finally, you need to delete the contents of the (magento base)/var/cache direction and update any custom redirects in your .htaccess files. If you changed any of the database settings, update it in (magento base)/app/etc/local.xml. Finally, clear the cache in your browser to remove any cached 301 redirects.

Tags: ecommerce, website, magento

Contact Us To Setup A Meeting

Feel free to call or email anytime to setup a meeting. We would love to discuss your project to see if we can help!

contact us