Web.config 并将子域映射到文件夹
我有三个子域:dev.mydomain.com
、archive.mydomain.com
和 www.mydomain.com
。
是否可以创建一个 web.config
文件,将对给定子域的请求映射到与该子域匹配的 Web 根目录中的文件夹?
例如,如果我的 D:\inetpub
文件夹包含 dev\index.cfm
、archive\index.cfm
和 www\index。 cfm
,我想将 http://dev.mydomain.com/index.cfm
的请求映射到第一个 http://archive.mydomain.com /index.cfm
到第二个,http://www.mydomain.com/index.cfm
到第三个。
感谢您的考虑!
I've got three subdomains: dev.mydomain.com
, archive.mydomain.com
, and www.mydomain.com
.
Would it be possible to create a web.config
file that will map requests to a given subdomain to a folder sitting in the webroot that matches that subdomain?
E.g. if my D:\inetpub
folder contains dev\index.cfm
, archive\index.cfm
, and www\index.cfm
, i'd like to map requests to http://dev.mydomain.com/index.cfm
to the first, http://archive.mydomain.com/index.cfm
to the second, and http://www.mydomain.com/index.cfm
to the third.
Thanks for your consideration!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议您研究一下 URL 重写。有一些很棒的付费和免费 在那里。它们在 IIS 级别获取所有请求,将它们与正则表达式表进行比较,然后默默地重新映射您指定的 URL。
根据你的表达方式,可能会是这样的:
I'd recommend that you look into URL Rewriting for this. There's some great paid and free ones out there. They take all requests at the IIS level, compare them to a regular expression table and silently re-map and URLs that you specify.
Depending on what you go with your expressions would be something like:
您可以通过使用主机标头在 IIS 上简单地完成此操作。
You can do this simply on IIS by using host headers.