Monday, March 13, 2017

Changing your website's domain name - a Walkthrough

Hi friends,

Yesterday I did a successful domain name migration for a client from a .cu.cc test domain to a .org final domain. (host remained the same so we did not move the site - only changed the domain / URL / address)
I've done a few earlier but there's usually some mess happening but this time after quite some corrections I managed to get some steps in order. So sharing what worked on my end.

Time warning : This procedure is one with some nervousness because there is a throw-and-catch situation : Imagine a very delicate piece of crockery has been tossed at you like a ball, coming at your hands but your eyes are closed and you don't know if it'll be caught properly or not. So it's good to plan things out and have patience. Also, in this the site's new address went "down" while the old test URL also didn't work for about 1 to 2 hours in my experience, so it is advisable to do it at a time when you're not expecting anyone to visit, like early morning or so.

Disclaimer : This is just my experience and things can go differently on your end. Apologies in advance if something goes wrong, but I probably won't be able to help you fix things.

My use case scenario : Domain (.org) is hosted on bigrock. Website is hosted on godaddy (single site, 30GB plan) and has been developed in wordpress while having a temp .cu.cc (free) domain name assigned to it. So the .cu.cc domain name was to be removed and the proper one was to be put.

Terminology : I will henceforth refer to "bigrock", "godaddy", "wordpress" to indicate the admins of the bigrock domain name management, godaddy web hosting cpanel and wordpress dashboard respectively.

1. Prep: open in different tabs and get logged in to ALL the places: wordpress, godaddy, bigrock, cu.cc. Also, note down and keep the customer care numbers of godaddy and bigrock on the side. (keep the customer id etc handy in a notepad window). In wordpress, backup everything.

2. Find Nameservers : Go to godaddy cpanel, and find "DNS management". In the new tab, choose your present site, click the settings wheel, and go through to seeing the DNS records. Now a large list of things should load, and probably in page 2 or the end you will see two nameservers listed, like "ns35.domaincontrol.com" . Copy these to the notepad window (and save!). More details here: https://in.godaddy.com/help/find-your-websites-nameservers-16140

2.1. Warning: We had got some nameservers mentioned in the initial hosting registration email, but they turned out to have been changed without any intimation from godaddy. The email said ns57/58 but in cpanel I found ns35/36. This caused unnecessary delay as for some time the new domain was pointing to the wrong nameservers. So always go into the cpanel and find the current suff and don't rely on the email if it is more than some months old.

3. Change Nameservers: Go to bigrock, open up your account domains listing and click on your domain to open its managent. Open "Name servers". Backspace out the existing ones and put in the new. Don't worry if there were 4 and you have only 2 now.. it's ok to leave the 3rd and 4th field blank. Save changes / Apply.

4. If you had earlier set this domain to redirect to somewhere else, then go to URL forwarding section (in bottom in bigrock), open it up and backspace/delete the URL completely and save changes.

4.1. Later on, in case the domain change didn't work yet, this URL forwarding could be a culprit... it might still be forwarding to an empty URL. For this in bigrock I had no other choice but to call up customer support and ask them to make sure there is no URL forwarding happening. Better to just do it from beginning, and inform them that you're making the domain point somewhere, please alert if doing anything wrong, what are the proper steps etc so all is clear from their side.

5. Ignore alerts : In the bigrock domain dashboard you will now see warnings / alerts about nameserver not being set properly. Check it out but don't change anything.. what they usually mean is that the nameservers aren't their's. That's ok; proceed.

5.1. Edit: Actually it's a good idea to take a break of an hour or more now, so that the DNS change propagates properly while your test site is still active. Didn't think of this earlier.

6. Go to GoDaddy cpanel. Find and open up the Change Main Domain name or similar sounding section. This is for changing the whole website's domain. Now.. keep this tab open but wait! don't make any changes yet.

7. Wordpress plugin : In wordpress, go to Plugins > Add new and install and activate this : "Search & Replace" See this page to verify you have the right one:: https://wordpress.org/plugins/search-and-replace/
Why this: Most online guides recommend Velvet Blues plugin, but in my experience I found that while it changes most URLs, it didn't change the image URLs of all the images, backgrounds etc on my site. I was using a pagebuilder so maybe there was some conflict there. But this plugin did the job properly. Additionally, this plugin is an open-source one (hosted on github) and gives more features free that are otherwise paid, especially the Dry Run and letting me see exactly what changes are being made.
Just install this plugin for now.. don't do anything with it yet.

8. Worpress URL update: Go to wordpress, Settings > General. Change both the URLs there to the new domain. ex: it was http://abc.cu.cc , I changed it to http://abc.org . And now we are beginning with the throw-and-catch. Go finish off your chores/toilet etc, drink some water and come back and have complete attention here.

8.1. Save Changes to save the change of wordpress URL. (press the Blue button!) The next screen should show error and in the URL bar or loading message you will see that it is trying to access the site using the new domain name. The crockery has been launched in the air. Don't panic. Proceed with next steps.

9. Go back to GoDaddy tab for domain change. Change it to your new domain. Keep out the www. etc.. just put in the name and extension like abc.org or the like. Save changes. It probably gives you some IP address and tells you to change the A record / IP addr of the new domain to this. Ignore it.. it's a flaw. When we do nameservers change, we do not need to do any of this stuff.

10. Go to cu.cc and login (or to the admin of whatever old domain you had developed the site in) Go to the management of the domain that we were using, and disable it by resetting or wiping out the nameserver, A record / IP address or whatever setting was there. If you were developing using a temp addr provided by GoDaddy (unlikely.. bigrock gives but godaddy doesn't) then don't bother doing anything.

10.1. It's important to disable the temp domain. When I didn't, my cu.cc domain was still pointing to my web sever's ip address, and visiting it surprisingly led one to a godaddy under-construction page and there was a link there that led straight to my godaddy cpanel! Serious security risk! :O

11. Recap : So we set bigrock to make your new domain point to your website's server. Then we changed the URL in our wordpress so it starts using the new path. Then we made the godaddy web hosting to change its name. Now it should "catch" the internet traffic that bigrock "throws" at it whenever anyone visits your site name.

12. It's now a waiting and praying game for the domain change to take effect, or to "propagate". Open a new tab and go to your site (new name). It probably gives an error. I found that some internet connections change their DNS and point to the new site more quickly than others.

12.1 There's a cool tool to keep track of this without wasting your time.. Go to this site : "Follow that Page" : https://www.followthatpage.com . Sign up to make an account, and add your new site name. Set the frequency to highest possible. Now that site will do the job of tracking changes for you and email you as soon as something happens. If the site name is still giving error 2 hours or more later, please call up customer care on the domain side (what to say I already wrote earlier).

13. I'm assuming that the "catch" has happened now : the website has been updated to the new domain name. Yay! Pat yourselves on the back! Now, few more steps left. You'll notice even though the site loads, images / backgrounds are gone and maybe some things look funny.

14. Login to your wordpress dashboard on the new path ( like abc.org/admin or abc.org/wp-login.php) .

15. Go to Settings > Permalinks. Set to whatever setting you want and save changes. This forces the system to set most of the internal links, menu links etc in order.

16. Go to Tools > Search & Replace. Take and save a backup of the database as advised, then go to the second tab. Search for : old site name. Replace with : new name. Keep them without http:// or other extra chars like /. (like : abc.cu.cc and abc.org ).. just keep the main stuff so you get a clean sweep. Select all tables by clicking the checkbox. Keep the Dry Run option checked. Click the Blue Button (do it!)

17. Give it time. It will come back to this page again, but on top there will be an alert message like "500 changes" or so. Click to see details. Skim through the large table that opens up, and if you need to then press Ctrl+A and Ctrl+C to copy this. How to paste : Open notepad or a simple text editor and paste. Then remove the extra lines at top and bottom, and copy this and paste into an excel and save it for your reference. You'll have all your changes in a neat table. Close the details page.

18. Repeat the find+replace, only this time check OFF the Dry Run option and click the "Save changes to database" option below it that is now enabled. Press the Blue Button again.. do it! Wait some time, and again you'll see the results.

19. Now go to your site and check it out. To ensure things, clear out your browser cache (Ctrl+Shift+Del, check off other things and keep only Cache chosen and set the time to all time). Refresh the page fully by Ctrl+F5. Or open an incognito window or another browser and visit your website from there. Now the images should display properly and the website should be fully functional (Yay! Whew! Drink water!).

20. In case something went wrong, call up any customer care that you haven't called already. If everything is ruined then apologies, but read disclaimer on top.

21. Oh ya, clean up. Log out of all the domain, cpanel etc dashboards properly, save your passwords etc securely and don't leave anything open for your cat to come and accidentally delete everything. And you might want to go back to Follow that Page and delete the site check. (just remembered!) (don't worry, pressing Delete button on followthatpage site cannot and will not delete your site. It only disables the site-checking service)

Happy Migrating!

No comments:

Related Posts with Thumbnails