I'm trying to make it so when someone visits my site at sub.example.com
, it sends them to a different folder than someone who visits example.com
. Simple, yes? This is the code I use to do it:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/sub"
ServerName sub.example.com
ServerAlias sub.example.com
</VirtualHost>
I have the DNS for my domain set for a wildcard so that any subdomain still directs to my server.
The problem is, now whenever someone visits example.com
or sub.example.com
or any subdomain, it shows the content from /htdocs/sub
I only want it to show /htdocs/sub
when sub.example.com
is visited, how do I do that?
From what I've read my execution seems right, but maybe I've missed one thing that causes this to happen? I've reinstalled xampp to no avail
My main httpd.conf has this line ServerName example.com:80
if this helps