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

com and .co.uk domains, is it possible to create a virtual host to point to a single directory on the box?

At present I have

<VirtualHost *:80>
    ServerName www.domain.co.uk
    ServerAlias domain.co.uk
    DocumentRoot "C:/htdocs/domain.com/htdocs"

    <Directory />
    Options +Includes

    ErrorLog  "C:/htdocs/domain.co.uk/logs/error.log"
    CustomLog "C:/htdocs/domain.co.uk/logs/access.log" combined

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Yes just add them to your ServerAlias

ServerAlias domain.co.uk www.domain.com domain.com

Or you could do it like this:

ServerName domain.co.uk
ServerAlias *.domain.co.uk domain.com *.domain.com

I think you have som inconsistency problems with your posted code. Using both C:/htdocs/domain.co.uk/ and C:/htdocs/domain.com/

If it was up to me. I would put everything in C:/htdocs/domain.com/ and use the following

<VirtualHost *:80>
    ServerName domain.com
    ServerAlias *.domain.com domain.co.uk *.domain.co.uk
    DocumentRoot "C:/htdocs/domain.com/htdocs"

    <Directory />
        Options +Includes

    ErrorLog  "C:/htdocs/domain.com/logs/error.log"
    CustomLog "C:/htdocs/domain.com/logs/access.log" combined

Please note, when using *.domain.com (star-alias) in ServerAlias. If you wish to add a specific subdomain (example delicious-subs.domain.co.uk) in a new VirtualHost - pointing to another location. Then you will have to add that new VirtualHost with above/before the VirtualHost using the star-alias.

share|improve this answer
Great, worked a treat thanks for the help and the tip –  Brob Jun 27 '11 at 9:10
You're most welcome ;) –  Phliplip Jun 27 '11 at 9:15

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.