Category: General

How to Update Windows Hostfile to ensure domain points to a specified IP address

Note: this will trick your browser on the machine with the host’s file only.

The host’s file is normally found at the following path:

C:WindowsSystem32driversetchosts

Edit the file with a text editor, if for example, you want to force domain www.domain.com to point to IP address 1.1.1.1, you would add the following entry to the host’s file. Remember to remove the entry when you are finished.

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
::1             localhost

1.1.1.1 domain.com
1.1.1.1 www.domain.com

Save the file and close down all browsers after each change. Now hit www.domain.com from your browser and it will be pointing to the specified IP.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.