问题
Hi I'm using a BlogEngine.net for my blog and I would like to create 5 different subdomains and point to different subfolders(not redirecting). For example:
firstsubdomain.domain.com - domain.com/posts/helloworld.aspx
firstsubdomain2.domain.com - domain.com/posts/helloworld2.aspx
firstsubdomain3.domain.com - domain.com/posts/helloworld3.aspx
Thank you in advance for working example. I'm using asp.net 3.5, C#, Windows Server 2008, IIS 7
回答1:
I think you have to create a new web site in IIS manager, point it to the folder where the files are, and set the hostname to subdomain.domain.com
回答2:
You have to use URL rewriting if you limitation on IIS and if you have full control on IIS then can do using .htaccess:
Check these links for more details:
Web.config and mapping subdomains to folders
http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/
https://help.brinkster.com/KB/a125/how-do-i-redirect-a-domain-or-subdomain.aspx#b3
check this Ionic's ISAPI Rewrite Filter
IIRF is an ISAPI filter that does URL Rewriting for IIS. It's small, FREE, and easy to use. It is easy to install, fast, and powerful. You can get Search-Engine Friendly (SEF) or Search-Engine Optimized (SEO) URLs easily on IIS 6, 7, or 7+. It works with what you have, and there's help available to get you going. You can get the source code to inspect it or even modify it yourself.
来源:https://stackoverflow.com/questions/4285739/how-to-map-subdomain-to-the-subfolder