Well, here's something you could consider:
- Make entries in your
hosts
file for all the blocked domains, pointing to 127.0.0.1
(I suppose you're already doing this)
- Make a
<VirtualHost>
block in your Apache configuration that has a ServerAlias
line for each of the blocked domains. Or one of them could be a ServerName
and the rest ServerAlias
es. In this virtual host, you can either redirect all requests to the existing URL of your "blocked" error page, or (perhaps simpler) just put the error page in the document root.
Here's how I'd do it:
<VirtualHost *:80>
ServerName blocked.localhost
ServerAlias example.com
DocumentRoot /var/www/blocked.localhost/htdocs
# put the usual <Directory> section for that document root
</VirtualHost>
and move the whole contents of the blocked/
directory (on your filesystem) to /var/www/blocked.localhost/htdocs
. Obviously the pathnames are just examples.
Make sure a NameVirtualHost *:80
line appears somewhere in your Apache configuration. (Or if you want to catch requests on ports other than 80, that can be arranged as well)