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

What HTTP status code should an unconfigured vhost domain name return?

I have a vhost setup where I catch all unconfigured domains into a default vhost and serve a page informing that it is unconfigured.

Should I return a http error code to inform the client that something went wrong, and perhaps to keep the page from getting indexed? Or should I just return 200 and use robots.txt?

share|improve this question
up vote 1 down vote accepted

Use a boilerplate HTML file and robots.txt - if you may not get around to implementing the domain, it could help to have your contact details posted so potential buyers can reach you (particularly if you use a WHOIS proxy registration).

share|improve this answer
I guess I should disable the DNS altogether for domains I want out of reach. – Jens Björnhager Oct 4 '10 at 2:48

404 (Not found) is just fine:

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

In your case, there's nothing matching the URI in your vhost (yet).

Of course, you can return a page saying whatever you want at the same time, it doesn't have to be the default error page.

share|improve this answer

Of the list of HTTP status codes, it seems that 501 - Not Implemented may be the most appropriate. Honestly, I don't think it matters a whole lot, though. For my catch-all vhosts, I typically just serve a blank index.html. No legit user is going to end up there anyway, so anything that falls through to the default vhost is either a malicious script/bot, or someone who is just poking around and doesn't really need a real error code.

share|improve this answer
I suppose an empty document is an effective way of preventing indexing :P – Jens Björnhager Oct 3 '10 at 4:47
501 refers to the request not being recognised or the method not being understood (see RFC 2616: "This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource. "). In this case, the request to an unconfigured vhost is understood (presumably we're talking of a GET at least), the resource is just not there. – Bruno Oct 3 '10 at 11:42

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.