How to change Base URL in Magento

Sometimes it may be essential to change the BASE URL of Magento.
(Usually when you want to make a similar copy of Magento on another server!)

There are 2 – 3 simple steps involved in this:

Step 1: Edit old URL values in database
Table: core_config_data
In this table you need to edit the field named value containing specific values in the field named path!
Precisely saying you need to search for web/unsecure/base_url and web/secure/base_url and replace them with new values.

Please refer the images for an example.
OLD Values:
 image

New Values:
image

Step 2: Login to backend and clear Configuration cache!
This might be simply not possible and hence skip to next step!

Step 3: Find All entries of old domain name in the cache folder and replace them one by one.
Magento retains all configuration cache in /var/cache folder.
This step is  good for Advanced Users who can do file search and replace such strings in one shot 😉
If you are migrating a very big site, then this step will be certainly worth.

I use this “Unix Find Command” very useful in searching:


find . -exec grep -q www.magdummy.cws '{}' \; –print

Step 3: Now it’s time to clear the cache! (Normal User)
As already specified in step2, we know that Magento retains all configuration cache in /var/cache folder.
You can clear the entire contents in this cache folder. Magento regenerates all these files when needed.

Step4: View your new site in the browser.
It should now be working fine like the old one 😉

I hope this would work fine for you.
Please leave your comments or I would appreciate any idea that suits best in this case.