When we are migrating a WordPress site, we move the full site (files and database) from the old server to the new server. And before setting up the site domain to point to the new server, is common to check if the migration did occur well.
But in some cases, our new server not provide a way to access the new site with some temporary domain.
Therefore, we need to set up our OS (Windows in this case) to point the official domain to the new server IP, even that the domain – in fact – is still pointing to the old server for the other people on the internet.
In other words: our machine will be able to access the new server with the same domain while the rest of the world will keep access to your old server with the same domain.
This way, we can check if the migration was fine before setting up the DNS table to point officially for the new server.
So, lets to the practice! 🙂
In the file:
Add something like this:
IMPORTANT: remember to replace XXX.XXX.XXX.XXX by the server IP (eg: 220.127.116.11) that you wish to access and YOUR-DOMAIN by the domain you want to map of course.
After that open the Command Prompt App (Shortcut: CTRL + R > cmd > OK) and type this command three times:
Now you already able to type the domain in your browser address bar and access your WordPress installation in the new server that you set up (thought the IP address) in the host’s file.
IMPORTANT: After making the tests, remember to remove the two lines that we added before in the host’s file and type again 3 times the ipconfig /flushdns command in the cmd – Command Prompt App.