Forum Moderators: phranque
I am planning to movea 4 year old site from one host to another this week.
I've never done anything like this before, so I wanted so opinions.
Story:
* php-code bases site
* mysql database
My procedure:
1) Get new host, copy over all code from old to new
2) Modify code (for hard coded folder paths)
3) Create DB on new host, with same name
4) Export DB from old host to a file
5) Import DB from file to new host
6) Change DNS name with domain name registrar to new site
Once I am sure it worked, I will delete everything from old host and cancel account
Is my logic sound?
A problem I have is how can I test the new host before changing the DNS name? I mean, I can't just type the address, nor can I type the IP of the new host (it's not a dedicated serever for me)
Thanks
You now add the following line to your hosts file on your local PC at home below the line that starts with 127.0.0.1:
222.222.222.222 www.example.com
On Windows this hosts file is probably found in (...)\SYSTEM32\drivers\etc\hosts and on Linux in /etc/hosts
Now, after you type www.example.com in your browser window, the browser will not query a DNS server for the IP address of the server, but rather go directly to 222.222.222.222.
Maybe a reboot is necessary to clear an internal DNS cache and on some installations the hosts file is not active by default.
6) Change DNS name with domain name registrar to new site
Having just been down this road myself for the first time the one mistake I made was not also changing the IP's . My old host was also associated with the registrar and you could change the nameservers but it didn't do anything because you also have to provide the IP's for the nameservers. In my case this could only be done by the registrar which pretty much made it pointless to be able to change the nameservers in the first place...
Never saw this mentioned in any of the literature I read (possibly I did but this was a rush job and my head was swimming for few days)and since they were not listed on the registrar's page it never occurred to me.