Advanced Website Testing via the HOSTS File

During a website's migration process, you may want to test your website is working correctly on the new server before you change your DNS settings for your domain.

This tutorial explains an advanced method for testing your website on a new server before you update the domain name to point to the new server.

The advanced method of testing your website is to make your computer think your website is on a different IP, this can be done with a simple edit of the HOSTS file on your computer.

Modifying the hosts file involves adding two entries to it. Each entry contains the IP address to which you want the site to resolve and a version of the Internet address. For example, add the following two entries points, www.domain.com and domain.com, to the A record IP for your website's  this will have been provided in the welcome email from us or you can find the IP in cPanel, or contact us for help.

host_file_2.png

This Knowledgebase article provides instructions for locating and editing the hosts file on the following operating systems:

 Microsoft® Windows® 10, Windows 8, Windows 7, and Windows Vista

Microsoft Windows , Windows 2000, and Windows XP

After you add the domain information and save the file, your system begins to resolve to the IP address that you specified. When testing is complete, remove these entries.

Windows

If you are using a Microsoft operating system like Windows 10, Windows 8, Windows 7, and Windows Vista you must run Microsoft Notepad as an administrator.

Windows 10 and Windows 8

Use the following instructions if you’re running Windows 10 or Windows 8:

 Press the Windows key.

Type Notepad in the search field.

In the search results, right-click Notepad and select Run as administrator.

From Notepad, open the following file:

 c:\Windows\System32\Drivers\etc\hosts

Make the necessary changes to the file.

host_file_2.png

Select File > Save to save your changes.

Windows 7 and Windows Vista

Use the following instructions if you’re running Windows 7 or Windows Vista:

Select Start > All Programs > Accessories.

Right-click Notepad and select Run as administrator.

 The Windows needs your permission UAC window appears.

 Click Continue to grant permission.

 Notepad opens.

 In Notepad, select File > Open.

In the File name field, enter the following path:

 C:\Windows\System32\Drivers\etc\hosts

 Select Open.

Make the necessary changes to the file.

Select File > Save to save your changes.

Windows NT, Windows 2000, and Windows XP

Use the following instructions if you’re running Windows NT, Windows 2000, or Windows XP:

 Select Start > All Programs > Accessories > Notepad.

Select File > Open.

In the File name field, enter C:\Windows\System32\Drivers\etc\hosts.

Select Open.

Make the necessary changes to the file.

Select File > Save to save your changes.

  • 2 Utilizadores acharam útil
Esta resposta foi útil?

Artigos Relacionados

I'm receiving a blank page

If your website or web application is displaying nothing but a blank, white page, then chances...

Page is displaying 404 Page Not Found error

The 404 Page Not Found error means that the user requested a page on the server that does not...

My webpage is displaying ads

If your website is not pulling up and is instead showing advertisements, the most likely cause is...

Cannot connect to database

This error will occur within a web application when any of the following conditions are met:...

I can't login to cPanel

Ensure that caps lock is off, and that you are completely sure what your cPanel password is. If...