Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Aren't you going to accept some answers we have you? Or at least comment our suggestions? –  FractalizeR May 24 '10 at 12:34

5 Answers 5

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.

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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

share|improve this answer

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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.