1

I have modified my etc/hosts file (under Windows 7), so that www.example.com and demo.example.com both point at localhost. Unfortunately accessing demo.example.com, takes me to localhost's document root (which is logical). I want to change this to point demo.example.com to demo.localhost, so make a new virtual subdomain on localhost and then the etc/hosts file should do it's work.

Could anyone point me in the right direction? I have this vhosts file, which has a valid syntax, but doesn't seem to be working as I want.

<VirtualHost 127.0.0.1:80>
ServerPath /demo-example/
ServerName demo.example.com
</VirtualHost>
Eduard Luca
  • 6,514
  • 16
  • 85
  • 137

1 Answers1

1

try to change the port number like this

<VirtualHost 127.0.0.1:8080>
    ServerPath /demo-example/
    ServerName demo.example.com
</VirtualHost>
Uday Sawant
  • 5,748
  • 3
  • 32
  • 45
  • Nope, still `demo.example.com` going to `example.com` – Eduard Luca Jan 14 '12 at 20:34
  • try to add directive 'NameVirtualHost' as `NameVirtualHost *` before virtual virtual hosts directive. read this link [subdomain conf] (http://content.websitegear.com/article/subdomain_setup.htm) – Uday Sawant Jan 15 '12 at 05:46