Thursday 20 October 2011

Host File


Editing Your Host File

For various reasons it may be necessary to update the hosts file on your computer to properly resolve a web site by its domain name. The most common reason for this is to allow people to view or publish web content immediately after purchasing a new domain name or transferring an existing domain name .

New and transferred domain names have a delay period that can be anywhere from a few hours to a few days. During this period of time the new or transferred domain information propagates around the internet, and is generally unavailable, But if you need to update your site immediately and cannot wait for the propagation of domain information around the internet, you can edit a file on your computer as a temporary work around.

Windows operating systems contain a file called ‘hosts’ that will force resolution of your domain name.




Step 1:-
              Open the hosts file
              Open the Folder
              C:\Windows\System32\drivers\etc
              Find the file called ‘hosts’ and double–click it. If prompted, specify that you would like to choose a                                                             
           program to open the file with from a list of programs.
              Choose ‘Notepad’ from the list of available programs. when you will open this it will show like this


step 2:-

              Edit and save the hosts file
              Start typing on a new line at the bottom of the file.
              To do so, place your cursor at the very end of the last line and hit ‘Enter’ to start a new line.
              Type these two lines of text like this example:
              (use your server IP address and your site domain in–place of the defaults below)
                            123.123.123.123    yourdomainname.com
                            123.123.123.123    www.yourdomainname.com
              Close the hosts file and save it when prompted.(You should be administrator to do this)
              When you are done it will look like this

PLEASE NOTE: At this point you should be able to view and publish to your web site using your domain name. After 3–4 days, you will want to undo this change to your hosts file so that you can check to see that your domain name is now resolving without assistance over the internet.
Undo the Hosts file change (after you have confirmed that it is resolving properly)
Open the hosts file as described above.
Delete the information that you added previously and close the file.
Choose to save the changes to the hosts file when asked.

Ok, now let say if you want to open your website in your PC when some one type www.google.com in your web brouser, to do that just add a line at the end of file, like this:-

              202.190.85.9(your website IP add) www.google.com

now when some one will type www.google.com in your browser then it will open website which is at your given IP address.

if you want to block some website in your PC then set its IP address to 127.0.0.1, like:-
                127.0.0.1                    www.yourwebsite.com

How to get your website IP address

              1st:- start cmd.exe and then type
              2nd:- ping www.yourwebsite.com

when you will ping any site it will show you like this
your IP address is 74.125.2.36.83

No comments: