Is it possible to rewrite subfolder to subdomain with IIS7?

本小妞迷上赌 提交于 2019-12-11 08:37:00

问题


I have an asp.net application on sub domain sub.domain.com I want to access this application by typing www.domain.com/sub is it possible with IIS7?


回答1:


Assuming you're happy to manually configure the application at each subdomain:

  • In IIS Manager, go to Sites, and select your www.domain.com site.
  • Right click it, "Add Application" and specify the alias "sub" and point the physical path to the same location as sub.domain.com
  • Select the same application pool as the sub.domain.com site.

Alternatively you could set up a redirect by creating a new Virtual Directory in your www.domain.com site, then dropping in a default.html file that does a http redirect.

A posher (and more transparent to the user) redirect could be done like so:

  1. Open an elevated command prompt
  2. run the following command:

    %windir%\system32\inetsrv\appcmd set config "nameofsite/virtualdirectoryname" -section:system.webServer/httpRedirect -enabled:true -destination:destinationofredirect -commitpath:apphost

I lifted that from: http://www.andrewwestgarth.co.uk/Blog/post/2008/07/31/Creating-Http-Redirects-in-IIS7-on-Virtual-Directories-like-IIS6.aspx



来源:https://stackoverflow.com/questions/6924693/is-it-possible-to-rewrite-subfolder-to-subdomain-with-iis7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!