Magento stores the base url in the database.
The easy way to change this is to use the admin interfece, but if that is not possible (for instance you have swapped ip for a dev machine – or moved data from a existing installation to another machine) then it is possible to do the update in the database.
- In the table “core_config_data” find the keys “web/secure/url” and “web/secure/url” and just update these to the new address. Hint: The addresses should end with “/” otherwise magento won’t like it.
- Clean out var/cache/* and var/session/* (use “rm -rf” on a *nix environment)