Changing base url / domain name of magento can be essential in some situations like while copying magento to another server or domain name.
To change the base url of your magentocommerce installation, follow these steps:
Step 1: Edit URL values in database
Got your database in phpmyadmin and open Table: core_config_data
In this table, edit the field named value containing some specific values in the field named path.
To be precise, you need to search for web/unsecure/base_url and web/secure/base_url values and replace them with the new values.
Please refer the images for an example.
Step 2: Login to new backend and clear Configuration cache
Now we need to clear the configuration cache. Ideally we should login to the new server and simply clear the configuration cache. However, this isn’t possible in this situation so we have to do it manually.
Goto the /var/cache/ folder and replace all entries containing the old domain name in this folder with the new one or simply delete the cache files.
Open your new domain name and confirm that everything is working fine (and not redirecting to the old one).