10

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.

4 Answers 4

8

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:

3
  • Actually I have found that I had it all set up correctly, but the file web.config didn't have the right data in it so it was missing a handler property. But thanks :-)
    – Techboy
    Jun 15, 2009 at 21:33
  • 1
    Ah, the missing .Net handlers. Glad you have it solved :)
    – palehorse
    Jun 16, 2009 at 18:36
  • 2
    A bit more of info would be nice...
    – Steve
    Jun 6, 2014 at 14:56
2

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
2

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.

1
  • My bad, I just realized the original site is hosted in a virtual directory. MattB's answer is more appropriate, but I'll leave mine up for general knowledge about host headers and IIS7 Jun 15, 2009 at 21:17
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .