apache virtual host question

Discussion in 'Web Design and Development' started by Cybix, Feb 8, 2007.

  1. Cybix macrumors 6502a

    Cybix

    Joined:
    Feb 10, 2006
    Location:
    Western Australia
    #1
    I want to have multiple domain names go to one site, wonder if I can do it with the 'serveralias' directive?

    eg:

    Code:
    <VirtualHost *>
        ServerAdmin joe@bloggs.com
        DocumentRoot /var/www/bloggs
        ServerName www.bloggs.com.au
        ServerAlias bloggs.com.au bloggs.com
        ErrorLog logs/www.bloggs.com.au-error_log
        CustomLog logs/www.bloggs.com.au-access_log common
    </VirtualHost>
    With the above ServerAlias directive, can I specify multiple names on the one line, I want "bloggs.com.au and "bloggs.com" to basically work just like "www.bloggs.com.au"

    Am I on the right track, or do I have to specify multiple ServerAlias directives within this virtual host like this:

    Code:
    <VirtualHost some.ip.address>
        ServerAdmin joe@bloggs.com
        DocumentRoot /var/www/bloggs
        ServerName www.bloggs.com.au
        ServerAlias bloggs.com.au
        ServerAlias bloggs.com
        ErrorLog logs/www.bloggs.com.au-error_log
        CustomLog logs/www.bloggs.com.au-access_log common
    </VirtualHost>
    I'm guessing that this one, will bug out, as you cant have a directive twice in a virtual host?

    Thanks in advance!
     
  2. angelneo macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #2
    I have just checked the documentation in apache.org. (assuming you are using at least v1.3), it does allow multiple domain delimited by spaces
     

Share This Page