Apache: multiple domains handling

Posted by cache on Server Fault See other posts from Server Fault or by cache
Published on 2012-06-27T20:53:02Z Indexed on 2012/06/27 21:19 UTC
Read the original article Hit count: 137

Filed under:
|

So I use following schema to handle multiple sites on my apache:

<VirtualHost 192.168.1.100:80>

# get the server name from the Host: header
UseCanonicalName Off

VirtualDocumentRoot /var/www/%0/docs
VirtualScriptAlias /var/www/%0/cgi-bin

</VirtualHost>

Therefore, if a client go to www.example.com, it will actually point to /var/www/www.example.com/doc/, which is good. However, what if the client go to example.com? It will point to /var/www/example.com/doc, which is not what we want.

So my question is: is there any better schema for that? Or what should I do to fix the issue?

Thanks!

© Server Fault or respective owner

Related posts about apache2

Related posts about vhosts