IIS7多域名绑定同一物理目录,设置不同默认文档的解决方案
Contents
刚好公司有这个需求,在网上找到这个教程,测试成功!收藏之~
以下为转载:
比如我们把www.a.com和www.b.com两个域名都指向c:wwwroot文件夹
想把www.a.com的默认文档设为目录aaa下的index.htm,www.b.com的默认文档设为目录bbb下的index.htm
1、新建两个站点,一个叫aaa(站点名字自己来起),指向c:wwwroot文件夹,绑定域名www.a.com;另一个叫bbb,指向c:wwwroot文件夹,绑定域名www.b.com
2、进入%windir%system32inetsrvconfig目录(%windir%即windows的安装目录,比如c:windows)
3、找到applicationHost.config文件,用文本编辑器打开
4、在最后configuration节中加入如下语句
<location path="aaa">
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear/>
<add value="aaa/index.htm"/>
</files>
</defaultDocument>
</system.webServer>
</location>
<location path="bbb">
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear/>
<add value="bbb/index.htm"/>
</files>
</defaultDocument>
</system.webServer>
</location>
```注意:aaa和bbb分别对应IIS上的站点名字
转自:http://www.feeldesignstudio.com/2011/04/iis7-different-domain-to-one-directory