Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i am running apache on (for example) 127.1.1.1, but have it set up so example1.com reads from /home/example1.com/, example2.com reads from /home/example2.com/

if i go to example1.com (or any other domain) it works fine - shows the correct files.

if i go to xxxxx.example1.com (that is, ANY sub domain), it shows the first entry in my vhosts file (so shows the first site i added).

if i go to 127.1.1.1 (its obv. not that ip...), it also shows that first site i added

how can i stop this? i believe just adding a "fake" first entry in my vhosts will still enable connecting to the site via IP or via any subdomain, so that won't work.

share|improve this question

migrated from superuser.com Nov 2 '09 at 10:42

This question came from our site for computer enthusiasts and power users.

    
@ineednotes, ensure to associate your account from Super User at superuser.com/users/16149?tab=accounts –  Arjan Nov 2 '09 at 10:50
add comment

1 Answer

You can configure a default virtual host and redirect traffic to a sorry page.

<VirtualHost _default_:*>
DocumentRoot /home/defaultvhost
RewriteEngine On
RewriteRule /.* http://mydomain.com/sorry.html [R]
</VirtualHost>
share|improve this answer
add comment

Your Answer

 
discard

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