LordZardeck
LordZardeck

Reputation: 8283

virtual hosts not working

I'm trying to add a virtual host to my server.

I want a.example.com to point to C:/xampp/htdocs/public.

I want b.example.com to point to C:/xampp/htdocs/b.example.com.

This is my virtual hosts setup:

<VirtualHost *>
    ServerName a.example.com
    DocumentRoot "C:/xampp/htdocs/public/"
</VirtualHost>

<VirtualHost *>
    ServerName b.example.com
    DocumentRoot "C:/xampp/htdocs/b.example.com/"
</VirtualHost>

For some reason, it just points to C:/xampp/htdocs/public

Upvotes: 0

Views: 2061

Answers (2)

You can also define each virtual host by the VirtualHost, like:

<VirtualHost b.example.com:80>

You can then use <VirtualHost *> as a catch-all default

Upvotes: 0

LordZardeck
LordZardeck

Reputation: 8283

Ok, I finally figured it out. you have to set NameVirtualHost *. Once I added that, it started working

Upvotes: 1

Related Questions