How to test a moved site, without editing DNS

Table of Contents

In case you’re moving your site to another server or another IP, you’ll have a need to test your site for problems. The best option is to copy the site to your new machine and test it before putting it online. So here is how to do it:

Windows #

STEP 1. Since we’ll work with “Notepad” go to “Start” and search for “Notepad“. Right-click the app and select “run as administrator“.

STEP 2. In File Explorer go to the “etc” folder. Here is the file path:

C:\Windows\System32\drivers\etc

STEP 3. As the next step – open the “hosts” file.

STEP 4. At the end of the file, you need to insert your new Ip and your domain name. Example:

000.000.000.000 yourdomain.com

STEP 5. Save the file and open your browser. Now when you are entering your domain, your computer will redirect you to a new IP. After completing all necessary tasks, it is advisable to remove the line added in the “hosts” file to avoid any unwanted redirects or conflicts in the future.

MacOS/Linux #

STEP 1. Open a Terminal app on your computer.

STEP 2. Using Nano or another text editor open “/private/etc/hosts” on Mac or “etc/hosts” on Linux.

sudo nano /private/etc/hosts
sudo nano /etc/hosts

STEP 3. At the end of this file add your new Ip address and your domain name.

Example:

000.000.000.000 yourdomain.com

STEP 4. Press “Ctrl + X” to exit and after that “Y” to save the changes. Then press “Enter“.

STEP 5. In your web browser enter your domain to see the site on your new server. Note that your computer is redirecting you to the new IP address due to the modification made in the “hosts” file. After completing all necessary tasks, it is advisable to remove the line added in the “hosts” file to avoid any unwanted redirects or conflicts in the future.

Powered by BetterDocs