Every online marketer at some point will need to move a website; whether they purchase one on Flippa, or switch to a new a web hosting company. Sometimes domain transfers can take days and you probably don’t want to wait for that. Maybe you want to verify everything is up and running ok on your new host before flipping the switch so you avoid any downtime. You should try and mimic everything 100% as it would be on the live site. Follow the steps below to preview your website before switching the DNS.
Preview Website Before Switching DNS
Step 1
Most managed WordPress hosts today have staging environments and temporary URLs. However, that is not the best way to view a site before migrating. I use Kinsta for hosting, so I first went into the MyKinsta dashboard and added the domain so that internally it would be attached to their IP.
I then updated by local hosts file on my computer and pointed the domain (in this case wpclipboard.com) to Kinsta’s IP, even though the live DNS was changed yet on the domain. See the next steps on how to do this.
Step 2
This tutorial assumes you are running Windows. You now need to launch your text editor as an administrator. In this example, I am using Sublime. But the same applies for Notepad++ or any text editor. I simply type in my text editor in my search menu and right click on it. Then I can select “Run as administrator.”
Step 3
Click on File > Open and browse to the following location. This is where your hosts file is located.
C:\Windows\System32\drivers\etc\hosts
Step 4
Type in the IP of your new web host and then your domain name. You can see the example of wpclipboard.com below. Then save the file.
Step 5
Now launch a new web browser and you will be able to test your site on the new host. I recommend when you do this that you test things such as logging into your WordPress admin dashboard, click around the site, etc. Once your testing or migration is fully completed, you remove the IP from your hosts file. A great free online service to test your DNS is WhatsMyDNS. I also recommend reading my tutorial on “How to Migrate Your WordPress Website to New Web Host.”
If this little tutorial on how to preview your website before changing your DNS was helpful, let me know below!