Wildcard subdomains in IIS7. Is it possible to make them like it is in Apache? Wildcard subdomains in IIS7. Is it possible to make them like it is in Apache? apache apache

Wildcard subdomains in IIS7. Is it possible to make them like it is in Apache?


The answer is No, IIS7 (still) does not support wildcard hostnames (see this). If you want to serve multiple domain on one website, the only workaround for now, as notandy suggested, is using a dedicated IP and doing it with DNS, which does support wildcards.

2013 Update

For completeness, IIS8 does not yet have this feature either.

2016 Update

Finally, IIS 10 in Windows 2016 supports wildcard subdomains.


Does IIS support wildcard host header? Can I capture and redirect *.mydomain.com to one web site?

The answer is Yes/No. Yes, because you areable to redirect *.mydomain.com to oneweb site. No, because the magic is inDNS and not IIS.

Here's how you do it:
At IIS MMC,configure a web site with NO hostheader, then assign an IP address tothe site. (if you have one IP addressin the box, then you can skip this).With this, the web site will bound tothe specific IP and will listen to allHTTP requests send to the IP, and youare done :)

Next step is to make sure your nameresolution works for the wildcardquery and reply with the correct IPaddress. If you using Microsoft DNSservice, it won't allow you to createa '*' A record (assuming you alreadycreated the domain zone in DNS MMC),you need to do the following:

  1. Navigate to %windir%\system32\dns\
  2. Find the zone file. E.g.
    mydomain.com.dns, open it with Notepad
  3. Add an entry. E.g.
    * A IP.IP.IP.IP
  4. Save the zone data file
  5. Reload the zone datain DNS MMC.

Take note that by doing this, all *will response to the IP that youconfigured earlier. E.g.abc.mydomain.com, www.mydomain.com,K2k.mydomain.com and etc.

To verify that it is working, try pingutility ping (insert anything here).mydomain.comand you shouldget replies from IP.IP.IP.IP

Then try browsing, http:// (insertanything here).mydomain.com/, youshould get the same web page that youhave configured.

Source


You cannot create a wildcard (*) A record in Microsoft's DNS, but you can create a wildcard CNAME. If all you are trying to do is direct all subdomains to a particular IP, this would work. For example, if you have an A record for www.mydomain.com, you could add a CNAME record for *.mydomain.com and point that at www.mydomain.com. The hostname in the request header will still be the subdomain, so your web app should be able to catch it and handle it if you want.