Forum Moderators: phranque
How can I configure IIS to accept any subdomain on a website?
It's not enough to redirect the user to a subfolder on a website. It has to accept all subdomains no matter what a user types. The subdomain is then handled by the application which will show the right content according to the subdomain.
An example would be:
If I typed test1.domainname.com I would see a webpage displaying "Welcome to test1" where test1 is read from the url. In other words, I need to be able to use the subdomain as a variable to show the right content and I don't want to add 5000+ enties to the IIS.
In the DNS I typed *.domainname.com and pointed it towards an IP, which works fine when I do a NSLOOKUP. But I can't get the IIS to accept the use of a wildcard as subdomain.
Is there a standard word to write as a wildcard in the IIS to accept all subdomains, like postmaster on a mailserver is all unused email addresses?
Yes if figured the wildcard subdomain out. There are only two way.
1/ Set the hostheader blank in the IIS configuration. This options requires that you run your own IIS or can convince your ISP that your site should be their default site :)
2/ Install a URL rewriter/ISAPI filter on the server and design your site accordenly.
My only option now is to invest in a dedecated server and have it hosted somewhere. Thanks Microsoft :(
You properly inserted an empty (blank) hostheader in IIS'en along with your IP. But if you have multiple domains you can't use this method unless you have multiple IP's on your server. You can only have one empty hostheader per server.
However this wont work for people using hosting solutions, unless their ISP will give/sell them an IP.
I don't understand why MS hasn't made it work with wildcards like in their DNS, so it would be possible to type *.domain1.com and *.domain2.com on another website using the same IP.
All requests to IIS for a domain that is not found in the host header of any site will go to the default web site. The default web site can parse out the 3rd level name in ASP if you need it to.
Not quite as clean of a solution as I'd like, but it does work. Better have a dedicated server, your ISP surely won't let you set something up as the default web site in a shared environment.
Hope this helps!
you didn't really understand me, I'mn afraid. I have my own domain registered in IIS (but that's beside the point, really). I host 5 other domains on the same IP. Like the subdomains, my default.asp detects the server_name the user is looking for and redirects them to the appropriate page.
I even set it up so I can add new domains or subdomains in a database. One new record, and a new (sub-)domain is live.
Now, explain again why this wouldn't work for you?
I must have misunderstood you. How did you make the IIS accept a wildcard subdomain so you can administrate the subdomains by using a database? I don't want to type sub1.domain.com, sub2.domain.com, sub3.domain.com etc. into the ISS. The only solution I can find is having domain.com as the default domain on the server?
I know it can be done with an Apachi server for windows, but I can't make MS IIS do it.
Keep in mind that each of these domains have the same IP-address, so when someone types www.domain1.com they arrive at the same destination as when they type www.domain2.com.
The same applies to someone typing mysubdomain.domain2.com. Just check server_name...