One of the hardest parts when you already found a buyer is transferring the website to the buyer with very small downtime. So far I haven’t encountered any article describing how to do this so I’ve decided to write one and share what I know.
1. Know the buyer
I know, I know, this phrase has become a cliche. However, the more you apply it, the more you realize how potent it is. Same with selling websites.
Ask the buyer 2 main things when you transfer the website to him:
- His domain name register. In my example, the buyer wanted to use NameCheap (which was the same I used)! This information saved me money (it costs around $8 to transfer a domain name.) How? I just contacted NameCheap and asked them whether it’s possible to transfer a new domain to another Namecheap user and they told me a free way to do it.
- His hosting. Common sense thinking here. If your hosting is different from his hosting, you want to know the name of the hosting company so in case you encounter a problem during the transferring process you can contact their live support (many hosting companies have 24/7 online live support.) In my case, both of us used Hostgator
2. Transferring the website: Data first, DNS records last
The last step of the overall process should be changing the DNS records. In Namecheap, they look like this:
The first step should be transferring the data of the website, so when you’re ready to transfer the DNS, the exactly same data is there just on a different server.
Here’s how you do that with WordPress:
- First, create an add-on domain using cPanel. I don’t recommend for the buyer to set up the domain I’m about to sell as the primary one for the sake of clarity. Again, I don’t recommend to set up the site as a primary domain. I made this mistake when trying to transfer my site from my other host. I couldn’t access the site at the beginning and had many problems afterward. Just don’t do the same please if you want to have 0 downtime.
- Backup the database. Use WP-DB plugin for WordPress, I’ve tested it and it produces the smallest database size.
- Install WordPress on the new web host as a clean installation (or you can copy all files, see this guide for more information.) I prefer to do a clean install (things can go wrong if you copy all the files and then you’ll have to find the root cause of the problem which is the hard part, with a clean install if a problem appears you usually know the root cause immediately.)
- After you install and configure WordPress, copy the wp-content folder from the old host to the new host. Then restore the database with phpMyAdmin (see instructions). Now you’re done with transferring the overall content and settings.
- Now, you should be able to access the domain at domainame.primarydomain.com. So if you’re trying to transfer 1stwebdesigner.com and the primary domain on your hosting is example.com, then you can access 1stwebdesigner on 1stwebdesigner.example.com. After you get to the homepage, you might get a 404 error when trying to open the posts. You need to update the Permalink structure (just to go Settings > Permalinks and click on ‘update’.) to fix this.
- Go to wp_options using phpMyAdmin and change “siteurl” and “home”. Using our previous example, if you want to transfer 1stwebdesigner.com and the primary domain for the hosting is example.com, you can access 1stwebdesigner on the new host using the URL: 1stwebdesigner.example.com. Now, after you made sure everything is okay and you’re ready to do the DNS transfer, use wp_options and change “siteurl” and “home” from 1stwebdesigner.example.com to 1stwebdesigner.com
- Go to your domain registar (Namecheap, Godaddy or some other one) and change the DNS Servers (see the first screenshot in this article.)
Now you need to wait several hours for the DNS to propagate. After that process is done, you should see your site on the new server. The process of transferring with 0 downtime is done.
To see whether the DNS servers are changed, a good trick I use is to place a simple html file on the old server. For example, I can place example.html on the old server with a simple text in it. I then try to open that file in my browser after few hours. If the file is located, that means the DNS transfer has not yet taken place. If the file is not located, that means the website is already on the new server (which doesn’t have that file.) This is helpful because the you have 2 identical copies on the servers so you need to find a separator like this.
That’s it! This process should be even simpler if you have a static website. If you try to transfer a website with Joomla or Drupal, the process should be a bit different. The basic concepts are the same, however. First transfer the data and then change the DNS servers.
Thanks for reading. How do you transfer websites between different hosts?