Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to put some entry in some file such as

www.google.com 127.0.0.1

So that whenever a linux user types the domain name www.google.com on his browser then the website hosted on the localhost comes. Can somebody tell me how to do this.

share|improve this question

closed as off topic by GregD, Ward, Iain, Bart De Vos, Maxwell Sep 22 '11 at 7:50

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 2 down vote accepted

What is answer?

linux: echo ' 127.0.0.1 www.google.com' >> /etc/hosts

windows:

put line into windows/system32/drivers/etc/hosts

share|improve this answer
    
if i am using proxy server to access my internet then this trick doesnot works since it redirects all traffic to proxy server. Can you please tell me how to do in that scenario. –  pradeepchhetri Sep 22 '11 at 5:52
    
ya thanks a lot .. i got that also .. what i did that in the browser i used the "no proxy for" option and put there www.google.com. Thanks –  pradeepchhetri Sep 22 '11 at 5:55

The file you're after is /etc/hosts

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.