We help IT Professionals succeed at work.

IIS 6: How map subdomain to a virtual directory?

I have a site with virtual directory called 'dev' that's accessed like this:
http://www.mydomain.com/dev
We got creative and created a subdomain called 'dev.'  How do I configure the system so that dev.mydomain.com maps to the 'dev' virtual directory so that
http://dev.mydomain.com
(without the /dev directory at the end) runs the same directory like before we added the subdomain?
Comment
Watch Question

This involves a new DNS record dev.mydomain.com to point to your web server ( This has to be done on the DNS server not on the web server)

Author

Commented:
I have to create two DNS records?  What does the second one do?
DevOps Manager
Top Expert 2011
Commented:
Correct,

Regardless, you need an A Record for dev.mydomain.com to point to your local ip.addr.adrss for the webserver.

Some options are;

1. Setup a completely new Website in IIS, Add that DNS record as the host header or Binding and make the site webroot c:\.....\dev.

2. You could setup a URL REWRITE to listen for the incoming domain dev.mydomain.com to rewrite to /dev.  In IIS6 you can use Helicon ISAPI rewrite and in IIS7 IIS Rewrite module.
 
Before i provide examples for IIS, what version are you running? IIS6 or IIS7?

Best Regards,
Hades666

Author

Commented:
Thank you.  Windows Server 2003 so I think IIS 6.
Brad HoweDevOps Manager
Top Expert 2011

Commented:
Saw it in the question title. Missed it this morning when responding. I'll get a rewrite rule up for you shortly.

Cheers,
Hades666

Author

Commented:
It's trivial: create a new website and specify the subdomain.domain.com in the host header field.  No additional DNS work is required.