Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I seem to be having a bit of trouble with virtual hosts in Apache.

I have added to my hosts file in Windows and I see my web server fine.

I then added the below to my conf file, as the very end, I don't know if it matters where it goes!

NameVirtualHost *

<VirtualHost *> 
ServerName unknown
DocumentRoot "C:/xampplite/htdocs"

DocumentRoot "C:/xampplite/htdocs/mysite"

So what I am trying to achieve is going to will bring up /mysite folder and anything else - or just going to will default back to the main htdocs folder.

But it doesn't.

It all ends up going to the mysite folder.

Looking at the error log this occurs on start up:

[Tue Sep 13 19:45:08 2011] [error] VirtualHost _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

For the record I listen to ports 80 and as lame as it is, 1337.

share|improve this question

migrated from Sep 15 '11 at 6:02

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Try this config:

DocumentRoot "C:/xampplite/htdocs/"

<VirtualHost *:80>
    DocumentRoot "C:/xampplite/htdocs/mysite"
    <Directory "C:/xampplite/htdocs/mysite">
        allow from all
        Options +Indexes

So when you use: it will go to the default DocumentRoot ("C:/xampplite/htdocs/") and when you use it will go to: "C:/xampplite/htdocs/mysite". You don't need NameVirtualHost

share|improve this answer

Your Answer


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