How to test a moved site, without editing DNS
Learn how to test a site moved to a new server or IP address without changing DNS settings by editing the hosts file.
How to Test a Moved Site Without Editing DNS
In case you’re moving your site to another server or another IP, you’ll need to test your site for problems. The best option is to copy the site to your new machine and test it before going live. Here’s how to do it:
Windows
STEP 1. Open Notepad as an administrator. Go to Start and search for Notepad. Right-click the app and select Run as administrator.
STEP 2. Navigate to the etc folder:
C:\Windows\System32\drivers\etc
STEP 3. Open the hosts file.
STEP 4. At the end of the file, add your new IP and domain name. Example:
000.000.000.000 yourdomain.com
STEP 5. Save the file and open your browser. Now when you enter your domain, your computer will redirect you to the new IP. Remember to remove the added line from the hosts file afterwards to avoid unwanted redirects.
MacOS/Linux
STEP 1. Open a Terminal app.
STEP 2. Using Nano or another text editor, open the hosts file:
For Mac:
sudo nano /private/etc/hosts
For Linux:
sudo nano /etc/hosts
STEP 3. At the end of the file, add your new IP address and domain name:
000.000.000.000 yourdomain.com
STEP 4. Press Ctrl + X to exit, then Y to save changes. Press Enter.
STEP 5. In your web browser, enter your domain to see the site on your new server. Note that the modification in the hosts file redirects your computer to the new IP. Afterwards, remove the line added in the hosts file to prevent future conflicts.
Related Articles
Browse more articles in these categories.