Map the User Friendly Host Name With Its Corresponding IP Address Using Host File In IIS8

Introduction

In this  article I am going to cover how to map the user-friendly host name with its corresponding IP address using Host File in IIS.

Background

A few days back I got a requirement to change the IP address of our locally hosted website in IIS 8 of Windows server 2012 R2, since it was difficult for the client to remember the IP address every time.

Screen Shot of Expected Output

Before Changing host file 


Now I am going to change this to some user-friendly name, for ex : www.Karthiksachin.com

After Changing the Host file

Let's see step by step how can we achieve this.

Before the steps, a brief Intro about host file:

What is host file?

In simple words, Host file is like a Telephone directory which will contain the number(IP Address) and associated address(Host Name). So when you give a Host name like www.google.com into your browser, then the Host file is started to see if you have the IP address for that site. If you have, then your computer will get it and act accordingly, otherwise it will ask the details to the ISP.

Location of host file in file system

The path to the Host file in Windows is %systemroot%\system32\drivers\etc\ where %systemroot% is usually c:\windows unless you installed Windows on a different partition. So the same can be written as c:\Windows\System32\Drivers\etc\hosts.

Step 1 - To access the host file in Windows 7 you can use the following command in the Run Line to open notepad and the file.

Then it will open the following text file as shown below,



Then it will open the default file like below

Original File before changing how it looks,

 
After changing the file as per requirement,


(Note: make sure you have taken the # symbol from that line because it denotes comment)

That's it from the host file point of view.

Now just change following in the IIS, like the below screen shots,





Output


Tried the Same in Window server 2012 R2

Output

I hope the above information was a little bit helpful. Kindly share your valuable comments or feedback.