On Wed, Jun 18, 2003 at 04:01:07PM +0800, El 4Love wrote:

> My virtual hosts at the moment are "www.mydomain.com.au" and
> "me.mydomain.com.au". "www.mydomain.com.au" also has a server alias
> "mydomain.com.au".  But when I type a URL like
> "blahblah.mydomain.com.au", it still opens "www.mydomain.com.au".

If Apache doesn't recognise the host name sent by the client, the
default is to use the first VirtualHost instead.

> How can I prevent this from going there and to display an error page
> when anything else is typed in the wildcard location?

Setup a virtual host and use AliasMatch to redirect every request to
your error page.  Make it the first VirtualHost container in
httpd.conf.  Something like this should work:

    <VirtualHost *>
        ServerAdmin [EMAIL PROTECTED]
        ServerName error.mydomain.com.au
        ErrorLog logs/error.mydomain.com.au/error_log
        CustomLog logs/error.mydomain.com.au/access_log combined
        DocumentRoot "/var/www/error.mydomain.com.au/html"
        AliasMatch .* /var/www/error.mydomain.com.au/html/error.html
    </VirtualHost>

More info at:

    http://httpd.apache.org/docs-2.0/
    http://httpd.apache.org/docs-2.0/vhosts/name-based.html


Cheers,

John
-- 
whois [EMAIL PROTECTED]
GPG key id: 0xD59C360F
http://kirriwa.net/john/
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to