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 have a website that is accessible only by IP address. How can I access a subdomain of that website?

share|improve this question
I'm using Ubuntu 10.04 by the way. – Nathan Osman Jul 21 '10 at 16:44
up vote 14 down vote accepted

Add to your /etc/hosts file, pointing to that IP.

share|improve this answer
Ah, I get it. Thanks! – Nathan Osman Jul 21 '10 at 16:48

It depends what you mean by "subdomain" and what you mean by "accessible only by IP address".

If, say, you're trying to access and, but for some reason your local DNS server doesn't have an entry for, then you may as well query it for as they're separate entries (usually).

If you don't have a domain name for the website but instead only an IP address, then what does a "subdomain" of that mean? Say you're browsing to, what is a "subdomain" of that?

Finally, it is usually pointless trying to reach a subdomain by connecting to the same IP address, as subdomain matching at the webserver-level is done by looking at the headers sent by the client, which wouldn't contain any subdomain information if you're connecting by IP address.

share|improve this answer

You have to add this IP address to your webserver as well if you are putting data into a particular directory and sharing the webserver with another website. If not, then you are just going to get the primary website and the subdomain will not do any good.

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.