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 doesn’t 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 though 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 to the new server.
So, let’s to the practice! 🙂
In the file:
Add something like this:
XXX.XXX.XXX.XXX www.YOUR-DOMAIN.com XXX.XXX.XXX.XXX YOUR-DOMAIN.com
IMPORTANT: remember to replace XXX.XXX.XXX.XXX by the server IP (eg: 188.8.131.52) that you wish to access and YOUR-DOMAIN by the domain that 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 are already able to type the domain in your browser address bar and access your WordPress installation in the new server that you set up (through 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.