I agree with @Azrael, but would like to expand it:
You can redirect your domain to a different page in each case, but what I would recommend doing, and what I do on most of my servers, prohibits all traffic, with the exception of traffic for the correct domain.
Apache 2.4 and later:
<VirtualHost *:80> ServerName catchall <Location /> Require all denied </Location> </VirtualHost> <VirtualHost *:80> ServerName allowed.com <Location /> Require all granted </Location> </VirtualHost>
Apache 2.2 and later:
<VirtualHost *:80> ServerName catchall <Location /> Order allow,deny Deny from all </Location> </VirtualHost> <VirtualHost *:80> ServerName allowed.com <Location /> AllowOverride All Order allow,deny allow from all </Location> </VirtualHost>
How it works, Apache uses ServerName to filter requests, however, any requests that do not match the VirtualHosts ServerNames names are sent to the first VirtualHost on the server, in this case the server_name in the first VirtualHost is βCatchallβ, which will not match any requests, so as it is not a valid domain name, but instead, since it is the first VirtualHost, it serves all inappropriate domains. Then we use the location container to define allow or deny directives.
If you want to use the file system instead of specific url directives such as 'Allow overide all', you can use the directory container instead of the location in the following format:
DocumentRoot /var/www/html <Directory "/var/www/html"> Require all granted Allow overide all </Directory>
source share