Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to point a URL to a particular IP address.But the IP belongs to the domain and I want it to point to a subdomain belonging to that domain.I am doing this by altering the hosts file in the etc directory.So is it possible for me to do that?

share|improve this question

Not sure I understand the question but if you want something like to point to particular IP address of your choice then yes, the hosts file will do that.

share|improve this answer
Yes but is there any way by which I can have a functionality of pointing a URL to a URL instead of an IP address? – Nilesh Chaudhary Dec 18 '12 at 9:58
You cannot point a url to another url using a hosts file. Maybe we can help if we know exactly what you're doing. – user72593 Dec 18 '12 at 10:12
Yeah I have a site hosted on my webhost account.I need to use a special IP on my workstation to access that site easily.But I am unable to do that.Is there an alternative solution to this? – Nilesh Chaudhary Dec 19 '12 at 6:14

Most likely: No.

The /etc/hosts file is like a local DNS-server. If your only concern is a local connection to the subdomain then it would work.

If you expect your visitors/users of your application to also see this subdomain entry, then it would not work as you expect.

You could then either visit everyone personally and alter their /etc/hosts file. While this sounds funny, it might be a quick solution if you want your co-workers see a certain subdomain correctly.

The other, more global solution would be an entry in your Nameserver. If you don't have access to those (I don't), then see if your provider has some webinterface to configure that or ask them.

EDIT: Please note that the /etc/hosts file is a simple mapping of domain-names to ip-addresses.

share|improve this answer

Your Answer


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.