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

Is it possible to make an apache ip based virutal host only respond to a specific host name?

I have a rouge domain name pointing to my server. I know I could redirect it or throw up a 401, but would just rather the server not even respond to a request with this hostname.

share|improve this question

Any request with a Host header that does not match the ServerName in any <VirtualHost> section falls through to the "main" server configuration. As such here is no way to outright prevent a connection, but you can "short circuit" the request by sending back a blank response, or by pointing DocumentRoot somewhere that doesn't exist.

share|improve this answer
Or send back a 404 following the advice given here:… – Matt Feb 19 '15 at 21:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.