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?
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
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
Not sure I understand the question but if you want something like subdomain.xyz.com to point to particular IP address of your choice then yes, the hosts file will do that.