3

I would like to create a few static subdomains like:

mycategory.mydomain.com

in a rather small website and would like it to point to the folder:

mydomain.com/mycategory

without showing such redirection in browser address bar.

What is an easiest way to achieve it? I can do it in either IIS settings, asp.net, C# code, etc

I guess there are better ways then creating a few separate Sites in IIS - one for each subdomain.

cpbills
  • 2,720
  • 18
  • 12
shg
  • 31
  • 1

5 Answers5

1

The quick and dirty way of doing what you're asking is to create a site container for each of the subdomains you want to have, and then have IIS do a static redirect to the original site container (mydomain.com/mycategory). This isn't the most elegant, but is easy enough to follow for anyone other than you to run the environment.

Another way of looking at it is to create a site container for *.mydomain.com and then use ASP.NET to parse out the requests to valid subdomains, etc.

Tony
  • 482
  • 3
  • 3
1

If you're using IIS7, a config file rewrite rule will definitely solve this for you. Check out http://iis.net as there are tons of examples in there of how to do exactly what you're after. A quick search showed lots of people doing the same thing though I recommend you review them instead of me posting a solution in case there are other things you want to do (outbound rules, etc.)

If you're using IIS6, we always used ISAPI Rewrite to do the same type of thing though the syntax is a bit different.

Phillip Jubb
  • 141
  • 1
0

May be URL rewrites are the thing you seek? Given that you know how to setup your DNS server.

Vladislav Rastrusny
  • 2,671
  • 12
  • 42
  • 56
0

well, you could bind to the same site in IIS and then use URL rewrite module to achieve this, I believe.

Robert Ivanc
  • 152
  • 6
0

Why do you want them to point to a folder on the main site? Why not either create sub-sites for those sub-domains or keep your standard domain and only use sub-folders?

Plus, I do not think what you want to achieve is a good idea SEO-wise; perhaps you do not care about SEO here...