How to create a Subdomain in IIS7?

In IIS7 I have a site: http://www.mydomain.com/mysite

How can I get the same site to appear as: http://mysite.mydomain.com ?

I already have the DNS set up and can ping it, I just do not know how to configure it in IIS7.


It should be as easy as creating a new web that points to the folder where /mysite is, then modifying the properties so that it accepts requests with the host header mysite.mydomain.com.

Here's a technet article on setting the host header:


2 options:

  • you can add a new binding to the existing site (Right click site, edit bindings, enter the IP/domain name of mysite.mydomain.com) - this will make it so the person has to go to http://mysite.mydomain.com/mysite, which is probably not what you want.
  • add a new site with the ip/domain of mysite.mydomain.com and make the root physical path be whatever directory www.mydomain.com/mysite points to

If it is the only site on that machine that will be responding on that IP address, you shouldn't actually need to configure anything. The default configuration responds to any request on the associated IP address regardless of what DNS name was used to get there.

If you'll be setting up other sites with different hostnames that are also living on the same IP address, you'll need to configure them using "Host Headers". In IIS7, host headers are set in the Bindings interface for each site. You can get there easily, by right-clicking the site in the IIS snap-in and choosing Edit Bindings. By default, you probably have 1 entry for port 80 assigned to a wildcard IP address. Select that entry and click the Edit button. The new dialog will have a Host name: entry where you can hard code what DNS name this site will respond to.


Creating Subdomain

open iis7 manager create a new website, type any name for site name, and point the physical path & IP Address which is assigned to your network adapter (port should be 80)and the hostname must be your subdomain name like blog.example.com (if your main site is example.com) apply ok.

Adding DNS Entry

Open DNS from administrator tools, expand computer name, expand forward lookup zone,click on example.com (means your domain name) In the right panel, right click on blank area, click on new aliases (CNAME), in alias name type your subdomain name, i.e. blog. In FQDN target host type your domain name i.e. example.com click ok.

Restart the DNS server. You have done with subdomain.