Followers

Tuesday, January 15, 2013

How to assign a name to an ip adress/redirect an ip adress


[Non-edited version] By Subhadeep Das
It often happens after creating a webserver, that, you have to type the ip iddress in the place reserved for URL in a web browser. It is cumbersome and appears very much annoying to people like us who are familiar using a domain name for a web server instead of ip. This can be resolved by adding the ip to a DNS server but in order to do that we need to send request to DNA administrator. The alternative and easiest way to solve the problem is to modify the "hosts" file of the Operating System of the local machine.

The "hosts" file can be found at computer/local Disk C/windows/System32/drivers/hosts (I don't know where it is located in linux  :(, sorry friends!!!  )

just add the line ip_address blank(or tab) desired_name_to_replace ip.
e.g- 12.137.229.119 Subhadeep.com

and you are done. from next time onwrds you just type Subhadeep.com instead of 12.137.229.119 and the same webpage will be open.

But, wait friends, the step to edit the hosts file is not that easy. You won't be able to edit web file if you do not access the hosts file as Administrator.

To do it, follow the steps-

1)go to start menu
2)expand all programs
3)go to accessories
4)type notepad at search
5)right click on notepad
6)click on "Run as Administrator"
7)a blank notepad will be open, now go to file of notepad window
8)go to open
9)follow the path to hosts file, i.e go to local Disk C/windows/System32/drivers/hosts 
10)click open
11) add 12.137.229.119 Subhadeep.com
12) save the file
13) enjoy.


Do it. You owe me a treat friends.   :D

3 comments:

  1. I guess! ....that host file you mentioned for editing can be foound in (/etc/hosts) path in linux based systems and in Mac OS X.
    Anywys helpful article!!

    ReplyDelete
  2. In linux the hosts file is also located at /etc/hosts . But in order to do anything to this file, you will need to have a root access first.

    ReplyDelete
  3. Thanks nirveek. thanks ma'am. I'll try it (of course not in lab machines :D )

    ReplyDelete