What is the recommended approach to add static sub

2019-05-17 01:16发布

问题:

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.

回答1:

Setup multiple websites in IIS and assign a unique hostheader to each one of them (mycategory1.mydomain.com, mycategory2.mydomain.com, etc). Point each website to its destination folder.

More about hostheaders:

http://www.google.com/search?q=iis+host+headers



回答2:

IIS 7 supports URL rewrite better than any previous versions, http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

But there are also third party solution.

Like @adrianbanks suggested, serverfault.com is a better place to discuss such configuration only questions :)