Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have www.somesite.com blocked in my country. But I have another domain www.another.com that points to the same server and it's not blocked (Apache Virtual Host) and works fine.

I put an entry in hosts file of my computer as follows.

www.another.com          www.somesite.com

I still can't access www.somesite.com. Am I getting hosts file all wrong?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Yes, this is incorrect. Host files are designed to map a single host or a list of hosts to a single IP address. Instead, you've attempted to map a host to a host.

Assuming www.another.com and www.somesite.com do point to the same IP address, you could try the following.

1 - Ping the address you can resolve, which is www.another.com.

ping www.another.com

2 - Assuming the IP is 1.2.3.4, copy it into the host file, enter a space, then enter the domain you wish to map.

1.2.3.4   www.somesite.com

3 - On Windows, you may need to flush your browser cache. Open a command prompt and type:

ipconfig /flushdns

4 - You may still need to restart your browser. On Mac and Unix-based systems, the changes should be immediate.

Note that, depending on how the site is blocked, you may need to use other methods to get through. If it's blocked by your ISP and not DNS, then you'll likely need to look for an Anonymous proxy in order to fetch the content from a proxy in another country. You can find some proxies here, as well as on Google. Good luck!

Note: You can add more than one host to a single IP by spacing out the addresses:

1.2.3.4  my.domain.com  www.somewhere-else.com  anotheraddress.net
share|improve this answer
    
What if I say, this is single IP on which www.another.com, www.someother.com and few others are pointed by Apache Virtual Host. If I ping and get the IP address, this is not the webpage I want. –  Neutralizer Sep 29 '12 at 9:20
    
This is the explicit need to map host to host. Is there a way in windows and mac to do that? –  Neutralizer Sep 29 '12 at 9:22
    
No, you cannot control host to host, not without the IP. Plus, the target server, if using NameVirtualHost, will interpret the request by hostname anyway, so all you can do is tell your computer to point the domain to a specific IP address. Like I said, if this doesn't work, you'll likely just need to use a proxy. –  jmort253 Sep 29 '12 at 9:39
add comment

Hostfiles point a domain name to an ip address (effectively acting like a A record), you can't use it to point a domain name to another name (like a C record). It simply dosen't work that way.

share|improve this answer
    
Got it. Is there a way to explicitly map host to host in windows and mac? –  Neutralizer Sep 29 '12 at 9:29
    
The way you expect it to work? not really. If you map foo.net to bar.org, the request the server recieves is for bar.org. Not much use there. –  Journeyman Geek Sep 29 '12 at 9:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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