How do I prevent Apache from answering requests for domains I don't host?

Arcymag asked:

Someone has pointed their domain ( to the same IP as my domain ( , and Google is now showing the former when searching for Kapparate, rather than the latter. What’s the best way to block requests coming from ?

My answer:

You should put your actual web site in an Apache <VirtualHost> block, and have the default host serve only the Apache test page.

If you are using name-based virtual hosts, like most people, then just ensure that the default virtual host appears first in your configuration. You can check your configuration with a command such as httpd -S.

See also Apache’s examples for more information.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.