Question

I am trying to edit the hosts file in MAC OS X Mavericks. And am trying to do something like this.

 sudo vim /etc/hosts

Then I edit the hosts file like such, Just after the broadcasthost line I type this:

127.0.0.1:9999 www.fb.com

Then I save the file by pressing escape and typing :wq. to save and exit.

But this is having no effect on the browser. Whenever I type in www.fb.com it directs me to the original facebook url. So later on after searching on the net I tried flushing the DNS cache

sudo dscacheutil -flushcache

But this also doesn't have any effect whatsoever.

Then I tried clearing the browser cache manually by going to settings page in chrome and then clearing all the cache since the beginning of time and redoing the above step, but to no avail.

Can someone help, can we mention port along with the url, or is it just the URL that we can type in. In a fix!!

Was it helpful?

Solution

No, you cannot include a port number in the hosts file - it is not part of the hostname.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top